課程
/前端開發(fā)
/JavaScript
/JavaScript進(jìn)階篇
?tr.setAttribute("onmouseover",dis1(tr));
?tr.setAttribute("onmouseout",dis2(tr));
在添加按鈕時(shí),在新建的元素節(jié)點(diǎn)tr中添加這兩個(gè)屬性,咋沒(méi)有啥效果的
2016-05-04
源自:JavaScript進(jìn)階篇 9-22
正在回答
tr.setAttribute("onmouseover","dis1()"); tr.setAttribute("onmouseout","dis2()");
??function?dis1(){ ????debugger; ????console.log(event.target); ????this.style.backgroundColor="#f2f2f2"; ??} ??function?dis2(){ ????debugger; ????this.style.backgroundColor="#fff"; ??} ?? ??自己試下,看看this是什么,看看console.log(event.target)打印出什么。
我也覺(jué)得,要不加“”試下
然后,方法要不要也要用“”括起來(lái),試試吧
方法里面是不是應(yīng)該寫的是this?
舉報(bào)
本課程從如何插入JS代碼開始,帶您進(jìn)入網(wǎng)頁(yè)動(dòng)態(tài)交互世界
5 回答setAttribute
1 回答setAttribute()問(wèn)題
2 回答SetAttribute()問(wèn)題
1 回答setAttribute()方法
2 回答setAttribute問(wèn)題
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-05-10
2016-05-04
我也覺(jué)得,要不加“”試下
2016-05-04
然后,方法要不要也要用“”括起來(lái),試試吧
2016-05-04
方法里面是不是應(yīng)該寫的是this?