亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

這樣寫只能實現一行的背景變色和恢復原色

var change=document.getElementsByTagName("tr");

? ? change[0].onmouseover=function(){

? ? ? ? ?document.getElementsByTagName("tr")[0].style.backgroundColor="#f2f2f2";

? ? ? ? ? ?}

? ? change[1].onmouseover=function(){

? ? ? ? ?document.getElementsByTagName("tr")[1].style.backgroundColor="#f2f2f2";

? ? ? ? ? ?}

? ? change[2].onmouseover=function(){

? ? ? ? ?document.getElementsByTagName("tr")[2].style.backgroundColor="#f2f2f2";

? ? ? ? ? ?}

? ? change[0].onmouseout=function(){

? ? ? ? ?document.getElementsByTagName("tr")[0].style.backgroundColor="white";

? ?/* change[1].onmouseout=function(){

? ? ? ? ?document.getElementsByTagName("tr")[1].style.backgroundColor="white";*/

? ?/* change[2].onmouseout=function(){

? ? ? ? ?document.getElementsByTagName("tr")[2].style.backgroundColor="white";*/

如果把最后兩行任意一個解除注釋就無法實現題目要求的效果。這是為什么呢?

正在回答

1 回答

已經知道用循環會方便很多。但是這個問題還是不太明白。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

這樣寫只能實現一行的背景變色和恢復原色

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號