久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      JavaScript有沒有集合

      JavaScript中有集合,JavaScript中的HTMLCollection對象是類數(shù)組的HTML元素列表(集合)。getElementsByTagName()方法返回HTMLCollection對象。

      JavaScript有沒有集合

      本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版、Dell G3電腦。

      JavaScript中有集合,JavaScript中的HTMLCollection對象是類數(shù)組的HTML元素列表(集合)。getElementsByTagName()方法返回HTMLCollection對象。

      JavaScript中的DOM集合:

      length 屬性定義了 HTMLCollection 中元素的數(shù)量:

      示例:

      <!DOCTYPE html> <html> <body>  <h1>JavaScript HTML DOM</h1>  <p>Hello World!</p>  <p>Hello China!</p>  <p id="demo"></p>  <script> var myCollection = document.getElementsByTagName("p"); document.getElementById("demo").innerHTML =  "此文檔包含 " + myCollection.length + " 段文字。"; </script>  </body> </html>

      效果:

      JavaScript有沒有集合

      實(shí)例解釋:

      創(chuàng)建所有 <p> 元素的集合

      顯示集合的長度

      注:

      HTMLCollection 并非數(shù)組!

      HTMLCollection 也許看起來像數(shù)組,但并非數(shù)組。

      您能夠遍歷列表并通過數(shù)字引用元素(就像數(shù)組那樣)。

      不過,您無法對 HTMLCollection 使用數(shù)組方法,比如 valueOf()、pop()、push() 或 join()。

      【推薦學(xué)習(xí):javascript高級(jí)教程】

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)