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"}) 請問這句話是什么意思啊 document.all ? eval這個用法好像沒看過呀 this.style.還有這個用法 請大神指點
2016-08-17
這個意思是給str_tr[i]對象添加一個內(nèi)聯(lián)事件'mouseover',該事件體就是,判斷是否'document.all'有定義(以前只有IE有這個定義),也就是說如果是IE的話執(zhí)行后面的方法,eval()方法的作用就是計算后面的字符串,如果javascript代碼就執(zhí)行它。