video标签,如何用javascript实现 当点击(切换)按钮时class会变成='aa2’这时候video播放,再点击(切换)按钮后class会变成"aa_2 "且video停止播放。
<input type='button' onclick='qiehuan()' value='切换'class="touch_sr-only"/>
<div id='dianji' class='aa_1'>
<video src="/i/movie.ogg" controls="controls"></video>
</div>
<script>
$("#nannsd").click(function(){
var word = $.trim($("#nannsq").val());
if (word=="") {
return false;
}
window.location.href="/search?word="+word;
})
function qiehuan(){
var divEle= document.getElementById('dianji');
divEle.className=(divEle.className=='aa_1'?'bb_2':'aa_1');
}
</script>