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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

如何讓新添加的行也有跟隨鼠標(biāo)移動(dòng)的變色效果?

tianjia()函數(shù)里的最后一行 q() 為什么調(diào)用不了?

代碼如下

------------------------------------------------------------------------------------------------------------------------------

<!DOCTYPE html>

<html>

?<head>

? <title> new document </title> ?

? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??

? <script type="text/javascript">?

??window.onload = function q(){

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

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

? ? ? ? {

tr[i].style.backgroundColor="grey";

bianse(tr[i])

}?

}

? ? ? ?function bianse(ojb)

? ? ? ?{

? ?ojb.onmouseover=function(){

ojb.style.backgroundColor="pink";

}

ojb.onmouseout=function(){

ojb.style.backgroundColor="grey";

}

? }

? function tianjia()

? {

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

var trfather=tr[0].parentNode;

var newtr=document.createElement("tr");

var newtd1=document.createElement("td");

newtd1.innerHTML="xh00"+tr.length;

var newtd2=document.createElement("td");

? ?newtd2.innerHTML="姓名"

var newtd3=document.createElement("td");

var newtd3child=document.createElement("a");

newtd3child.innerHTML="刪除";

newtd3child.setAttribute("href","javascript:;");

newtd3child.setAttribute("onclick","shanchu(this)");

newtd3.appendChild(newtd3child);

newtr.appendChild(newtd1);

newtr.appendChild(newtd2);

newtr.appendChild(newtd3);

trfather.appendChild(newtr);

q();

}

? ? ? ? function shanchu(ojb)

{

var father=ojb.parentNode.parentNode;

father.parentNode.removeChild(father)

}

?</script>?

?</head>?

?<body>?

? <table border="1" width="50%" id="table">

? <tr>

<th>學(xué)號(hào)</th>

<th>姓名</th>

<th>操作</th>

? </tr> ?


? <tr>

<td>xh001</td>

<td>王小明</td>

<td><a href="javascript:;" onclick="shanchu(this)" >刪除</a></td> ? <!--在刪除按鈕上添加點(diǎn)擊事件 ?-->

? </tr>


? <tr>

<td>xh002</td>

<td>劉小芳</td>

<td><a href="javascript:;" onclick="shanchu(this)" >刪除</a></td> ? <!--在刪除按鈕上添加點(diǎn)擊事件 ?-->

? </tr> ?


? </table>

? <input type="button" value="添加一行" onclick="tianjia()" /> ? <!--在添加按鈕上添加點(diǎn)擊事件 ?-->

?</body>

</html>

------------------------------------------------------------------------------------------------------------------------------

正在回答

1 回答

你應(yīng)該用:

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

{

????tr[i].style.backgroundColor="grey";

????bianse(tr[i])

}?

代替你的:

q();

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

舉報(bào)

0/150
提交
取消

如何讓新添加的行也有跟隨鼠標(biāo)移動(dòng)的變色效果?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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