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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

rowIndex的問題

rowIndex的問題

qq_甘蔗_0 2015-11-23 21:18:57
<!DOCTYPE html><html><head><title>test</title>? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/><script type="text/javascript">function deleteRow(r)? {? var i=r.parentNode.parentNode.rowIndex;? document.getElementById('myTable').deleteRow(i);? document.getElementById("in").value=i;? }</script></head><body><table id="myTable" border="1"><tr>? <td>Row 1</td>? <td><input type="button" value="刪除" onclick="deleteRow(this)"></td></tr><tr>? <td>Row 2</td>? <td><input type="button" value="刪除" onclick="deleteRow(this)"></td></tr><tr>? <td>Row 3</td>? <td><input type="button" value="刪除" onclick="deleteRow(this)"></td></tr></table><input type="text" id="in"></body></html>方法中var i=r.parentNode.parentNode.rowIndex;為什么i可以得到r對應(yīng)行的序號,和rowIndex的實現(xiàn)機制有關(guān)么?r.parentNode.parentNode得到的是table節(jié)點,table節(jié)點的rowIndex得到的是什么?
查看完整描述

1 回答

已采納
?
李曉健

TA貢獻1036條經(jīng)驗 獲得超461個贊

r.parentNode.parentNode 得到的是tr ?tr有一個屬性是 rowIndex

r.parentNode.parentNode.parentNode 得到的是tbody ?tbody沒有rowIndex屬性?

r.parentNode.parentNode.parentNode.parentNode 得到的是table ?table也沒有rowIndex屬性

沒有的屬性去取值就會得到?undefined

查看完整回答
反對 回復(fù) 2015-11-23
  • 1 回答
  • 0 關(guān)注
  • 2267 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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