请问为什么我把onmousemove事件写到function cutday里面再执行就会失效啊。下面那个tr2是可以正常执行的。上面的tr1写进函数里就不能执行。会报错。新人不懂。。求指点
<script type="text/javascript">
function cutday(a,b){
var a = document.getElementById('a');
a.onclick = function(){
var tr_list = document.getElementsByClassName('tr_list');
for(var i = 0 ; i < tr_list.length ; i++){
tr_list[i].style.display = 'none'
}
document.getElementById('b').style.display = 'block'
};
}
var tr2 = document.getElementById('tr2');
tr2.onmousemove = function(){
var tr_list = document.getElementsByClassName('tr_list');
for(var i = 0 ; i < tr_list.length ; i++){
tr_list[i].style.display = 'none'
}
document.getElementById('tr_pic2').style.display = 'block'
};
cutday(tr1,tr_pic1)
</script>
婷婷同学_
相关分类