<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                學過HTML/CSS樣式,都知道,網頁由標簽將信息組織起來,而標簽的id屬性值是唯一的,就像是每人有一個身份證號一樣,只要通過身份證號就可以找到相對應的人。那么在網頁中,我們通過id先找到標簽,然后進行操作。 **語法:** ~~~ document.getElementById(“id”) ~~~ **看看下面代碼:** **[![](http://img.mukewang.com/52e4c5950001054207900423.jpg)](http://img.mukewang.com/52e4c5950001054207900423.jpg)** **結果:null****或\[****object HTMLParagraphElement\]** **[![](http://img.mukewang.com/52e4c6080001734c03800275.jpg)](http://img.mukewang.com/52e4c6080001734c03800275.jpg)** **注:獲取的元素是一個對象,如想對元素進行操作,我們要通過它的屬性或方法。** ### 任務 在右邊編輯器中,補充第10行代碼,通過document.getElementById獲取id為con的p標簽。 第11行為輸出獲取的元素,看看結果是什么。 ``` <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>document.getElementById</title> </head> <body> <p id="con">JavaScript</p> <script type="text/javascript"> var mychar= document.getElementById("con"); document.write("結果:"+mychar); //輸出獲取的P標簽。 </script> </body> </html> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看