第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

為什么不設(shè)置bgcchange函數(shù)就改變不了背景顏色

? ? ? ? ? window.onload = function(){

? ? ? ? ? ? ? ? ??

? ? ?// 鼠標(biāo)移動改變背景,可以通過給每行綁定鼠標(biāo)移上事件和鼠標(biāo)移除事件來改變所在行背景色。

? ? ? ? ?var app=document.getElementsByTagName("tr");

for(var i=0;i<app.length;i++)

? ? ? ? {

? ? ? ? ? ? app[i].onmouseover=function(){

? ? ? ? ? ? ? ? app[i].style.backgroundColor="#f2f2f2";

? ? ? ? ? ? }

? ? ? ? ? ? ?app[i].onmouseout=function(){

? ? ? ? ? ? ? ? app[i].style.backgroundColor="#fff";

? ? ? ? ? ? }

? ? ? ? }

? ? ? }

像這樣寫是沒有效果的

然后添加了bgcchange函數(shù)就有效果了

?window.onload = function(){

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

? ? ? ? ? for(var i= 0;i<tr.length;i++)

? ? ? ? ? {

? ? ? ? ? ? ? bgcChange(tr[i]);

? ? ? ? ? }

? ? ?// 鼠標(biāo)移動改變背景,可以通過給每行綁定鼠標(biāo)移上事件和鼠標(biāo)移除事件來改變所在行背景色。

? ? ? } ? ? ? ??

function bgcChange(obj)

? ? ?{

? ? ? ? obj.onmouseover=function(){

? ? ? ? ? ? obj.style.backgroundColor="#f2f2f2";

? ? ? ? }

? ? ? ? obj.onmouseout=function(){

? ? ? ? ? ? obj.style.backgroundColor="#fff";

? ? ? ? }

}


正在回答

1 回答

好像是這樣的,改成這樣就可以了,函數(shù)內(nèi)app[i]沒有定義

for(var i=0;i<app.length;i++)

? ? ? ? {

? ? ? ? ? ? app[i].onmouseover=function(){

? ? ? ? ? ? ? ? this.style.backgroundColor="#f2f2f2";

? ? ? ? ? ? }

? ? ? ? ? ? ?app[i].onmouseout=function(){

? ? ? ? ? ? ? ? this.style.backgroundColor="#fff";

? ? ? ? ? ? }

? ? ? ? }


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

為什么不設(shè)置bgcchange函數(shù)就改變不了背景顏色

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號