JavaScript base 15--js Dom Object

Source: Internet
Author: User

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "UTF-8">5         <title>The DOM object of JS</title>6         <Scripttype= "Text/javascript">7             //Dom:document Object Model Document objects8             /*9 documents: Hypertext document HTML, XMLTen object: Provides properties and methods One model: Manipulating Hypertext-tagged documents using properties and methods A You can use the JS DOM-provided object to manipulate the tagged document using the properties and methods of these objects - you need to encapsulate the tags, attributes, and text contents of HTML into objects. -              */ the              /*  - There are three types of DOM models - DOM Level 1: Encapsulate an HTML document as an object - DOM Level 2: Add new features based on the 1, for example: Support for events and CSS styles + DOM Level 3: Support for some new features of XML 1.0 -              */ +              /*  A parsing Process at Assigning a tree structure in memory based on the hierarchy of HTML requires that each part of the HTML be encapsulated as an object - Document: Entire HTML document - element: Tag Object - Property Object - Text Object - Node Nodes object: Is the parent object of these objects in              */ -              /*  to Common Properties + all[] Provides access to all HTML elements in the document, FF does not support - forms[] Returns references to all form objects in the document the body provides direct access to <body> elements * Common Methods $ getElementById () returns a reference to the first object that owns the specified IDPanax Notoginseng Getelementsbyname () returns a collection of objects with the specified name - getElementsByTagName () returns a collection of objects with the specified label name the write () writes HTML code or JavaScript code to the document +              */ A window.onload= function() { the                 varspans=document.getElementsByTagName ("span")[1]; +                 //For (var i = 0; i < spans.length; i++) -                 //{ $                     //var span = spans[i]; $ document.write ("<br/>span:" +spans.innerhtml); -                 //} -              } the         </Script> -     </Head>Wuyi     <Body> the         <BR/><BR/><BR/> -         <span>AAAAA</span> Wu         <span>bbbbb</span> -         <span>Ccccc</span> About         <span>Ddddd</span> $     </Body> - </HTML>

JavaScript base 15--js Dom Object

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.