• ARعربي
  • ENEnglish
  • ESEspañol
  • FAفارسی
  • FRFrançais
  • IDIndonesia
  • ITItaliano
  • JA日本語
  • KO한국어
  • RUРусский
  • TRTürkçe
  • UKУкраїнська
  • ZH简体中文

ما قصد داریم این پروژهٔ متن‌باز را در دسترس همهٔ مردم در سرتاسر دنیا قرار دهیم.

به ترجمهٔ محتوای این آموزش به زبان خودتان کمک کنید/a>.

    نقشه آموزش
    اشتراک گذاری
    • آموزش
    • مرورگر: Document، Eventها، رابط‌ها
    • Document
    • Node properties: type, tag and contents
    بازگشت به درس
    این محتوا تنها در این زبان‌ها موجود است: عربي, English, Español, Français, Italiano, 日本語, 한국어, Русский, Українська, 简体中文. لطفاً به ما

    What's in the nodeType?

    اهمیت: 5

    What does the script show?

    <html>
    
    <body>
      <script>
        alert(document.body.lastChild.nodeType);
      </script>
    </body>
    
    </html>

    There’s a catch here.

    At the time of <script> execution the last DOM node is exactly <script>, because the browser did not process the rest of the page yet.

    So the result is 1 (element node).

    <html>
    
    <body>
      <script>
        alert(document.body.lastChild.nodeType);
      </script>
    </body>
    
    </html>
    • © 2007—2025  Ilya Kantor
    • دربارهٔ پروژه
    • تماس با ما