cc_0501
2015-10-14 19:39
请问一下源代码里面的this代表的是什么?
function Highlight(){
var tbody = document.getElementById('table').lastChild;
trs = tbody.getElementsByTagName('tr');
for(var i =1;i<trs.length;i++){
trs[i].onmouseover = function(){
this.style.backgroundColor ="#f2f2f2";
}
trs[i].onmouseout = function(){
this.style.backgroundColor ="#fff";
}
}
}
表示当前function作用的对象。
当前对象,一般代表html网页本身
JavaScript进阶篇
469060 学习 · 22582 问题
相似问题