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

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

為什么顯示不出來

<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8">
<title>nextSibling</title>
</head>
<body>
<ul?id="u1">???
????????????<li?id="a">javascript</li>???
????????????<li?id="b">jquery</li>???
????????????<li?id="c">html</li>???
????????</ul>???
????????<ul?id="u2">???
????????????<li?id="d">css3</li>???
????????????<li?id="e">php</li>???
????????????<li?id="f">java</li>???
????????</ul>???
<script?type="text/javascript">
????function?get_nextSibling(n){
????????var?x=n.nextSibling;
????????while?(x?&&?x.nodeType!=1){
????????????x=x.nextSibling;
????????}
????????return?x;
????}

????var?x=document.getElementsByTagName("li")[0];
????document.write(x.nodeName);
????document.write("?=?");
????document.write(x.innerHTML);
????
????var?y=get_nextSibling(x);
????
????if(y!=null){
????????document.write("<br?/>nextsibling:?");
????????document.write(y.nodeName);
????????document.write("?=?");
????????document.write(y.innerHTML+"<br>");
????}else{
??????document.write("<br>已經(jīng)是最后一個節(jié)點(diǎn)<br>");??????
????}
????
????function?get_previousSibling(n){
????????var?m=n.previousSibling;
????????while(m&&m.nodeType!=1)
????????{
????????????m=m.previousSibling;
????????}
????????return?m;
????}
????var?m=document.getElementsByTagName("li")[length-1];
????document.write(m.nodeName);
????document.write("?=?");
????document.write(m.innerHTML);
????
????var?n=get_previousSibling(m);
????
????if(n!=null){
????????document.write("<br?/>previoussibling:?");
????????document.write(n.nodeName);
????????document.write("?=?");
????????document.write(n.innerHTML);
????}else{
??????document.write("<br>已經(jīng)是第一個節(jié)點(diǎn)");??????
????}

</script>
</body>
</html>

var m=document.getElementsByTagName("li")[length-1];

這樣子寫的話,就沒有顯示。。

改成這樣的話就可以正常顯示var m=document.getElementsByTagName("li")[5];

正在回答

1 回答

改成var m=document.getElementsByTagName("li")[document.getElementsByTagName("li").length-1]

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

蒲公英shine 提問者

非常感謝!
2016-03-01 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
JavaScript進(jìn)階篇
  • 參與學(xué)習(xí)       468764    人
  • 解答問題       22416    個

本課程從如何插入JS代碼開始,帶您進(jìn)入網(wǎng)頁動態(tài)交互世界

進(jìn)入課程

為什么顯示不出來

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

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

幫助反饋 APP下載

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

公眾號

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