function highlightRows() { if(!document.getElementsByTagName) return false; var tables = document.getElementsByTagName("table"); for(var i=0;i<tables.length;i++){ var rows = tables[i].getElementsByTagName("tr"); for(var j =0;j<rows.length;j++){ rows[j].onmouseover=function(){ //rows[j].style.fontWeight="bold"; //这样无效 this.style.fontWeight="bold"; } rows[j].onmouseout=function() { //rows[j].style.fontWeight="normal"; //这样无效 this.style.fontWeight="normal"; } } }}为什么注释的那两行不行,非要用this呢,这里this不是应该就是指代rows[j]么?
添加回答
举报
0/150
提交
取消