str_tr[i].setAttribute('onmouseover',document.all ? eval(function(){this.style.background="#f2f2f2"})
str_tr[i].setAttribute('onmouseover',document.all ? eval(function(){this.style.background="#f2f2f2"}) 請(qǐng)問(wèn)這句話是什么意思啊 document.all ? eval這個(gè)用法好像沒看過(guò)呀 this.style.還有這個(gè)用法 請(qǐng)大神指點(diǎn)
2016-08-17
這個(gè)意思是給str_tr[i]對(duì)象添加一個(gè)內(nèi)聯(lián)事件'mouseover',該事件體就是,判斷是否'document.all'有定義(以前只有IE有這個(gè)定義),也就是說(shuō)如果是IE的話執(zhí)行后面的方法,eval()方法的作用就是計(jì)算后面的字符串,如果javascript代碼就執(zhí)行它。