Javascript在提交时禁用Div元素

时间:2012-08-10 18:38:51

标签: javascript html jsp javascript-events

大家好,               下面的代码隐藏了我正在播放的电影。删除元素(如果可能)或禁用它,特别是在后台播放电影。我尝试使用document.video.disabled = true;但它不起作用。不知道怎么解决这个问题..

<script type="text/javascript">
 function showHide() {
   var div = document.getElementById('wrapper');
   if (div.style.display == 'none') {
   div.style.display = '';  
  }
 else {
   div.style.display = 'none';
}

}

<form id="searchForm" name = "searchForm" onSubmit = "return fetchResults();">
<input id="q" name="q" type="text" alt="Search" placeholder="Type here">
<input type="hidden" name="wt" value="json" />
<input id="submit" type="button" value="Search" onClick = "fetchResults();showHide();changeStyle();" />

<div id="wrapper" style="display:''">
<div id="left">
random text 
</div>
<div id="right">
<video width="500" height="300" controls="controls" autoplay="autoplay" name="video">
  <source src="movie.mov" type="video/mp4" />
    <embed src="movie.swf" width="600" height="500" />
 </object> 
</video>
</div>
</div>

由于

1 个答案:

答案 0 :(得分:1)

尝试

function showHide() {
    var div = document.getElementById('wrapper');
    div.parentNode.removeChild(div);
}