慕粉1027459051
2019-06-23 17:09
<script type="text/javascript"> window.onload=function() { var s = document.getElementsByTagName("tr")[0]; for (var i=0;i<s.length;i++) { } s[i].onmouseover = function () { s[i].style = "background-color:red"; } s[i].onmouseout = function () { s[i].style = "background-color:green"; } } } </script>
for(var i = 0;i<tr.length;i++){
tr[i].onmouseover = function(){
this.style.backgroundColor = "#f2f2f2";
}
tr[i].onmouseout = function(){
this.style.backgroundColor = "#fff";
}
}
根据老夫30年代码的观写经验来看,是因为你这里多了一个大括号
JavaScript进阶篇
468062 学习 · 21891 问题
相似问题