2 回答

TA貢獻(xiàn)75條經(jīng)驗(yàn) 獲得超32個(gè)贊
第一個(gè)問(wèn)題,js沒(méi)有塊級(jí)作用域,就是你?rowList[i].className?=?"show";這里的i的值始終都是你最后循環(huán)的結(jié)果3
rowList[i].onmouseover = function(){
? ?this.className = "show";
}
rowList[i].onmouseout = function(){
? ?this.className = "hideShow";
}
第二個(gè)問(wèn)題,你var thisRow = this.parentNode; 這里的this是window對(duì)象,并不上你的tr這行對(duì)象,
<td><a onclick="del(this)" >刪除</a></td> ? <!--在刪除按鈕上添加點(diǎn)擊事件 ?-->
// ??!功能不能實(shí)現(xiàn) ? ? ? ? ? ?創(chuàng)建刪除函數(shù)
function del(thisNode){
? ?var thisRow = thisNode.parentNode.parentNode;
? ?thisRow.remove();
}
添加回答
舉報(bào)