I. Documentation (D)
A Web page runs in a browser, and he is a document object.
Ii. Objects (O)
An "Object" is a self-contained . A variable associated with a particular object is called a property of this object, and a function called only by an object is called the method of this object.
There are three types of objects in javascript:
① user-defined objects: do not know
② built-in objects (native object): JavaScript exists from the beginning. Columns such as array,math,date (JavaScript syntax is case-sensitive)
③ Host object: The object provided by the browser. columns, such as window objects, do not use this object as much as possible.
Iii. Model (M)
In the DOM, the model models represent the representation of a class of things, the browser provides a model of the Web page, JavaScript reads the model, obtains information, and operates the DOM.
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD"><HTMLxmlns= "http://www.w3.org/1999/xhtml"Lang= "en"> <Head> <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> <title></title> </Head> <Body> <H1>Dom</H1> <ul> <Li>1</Li> <Li>2</Li> </ul> </Body></HTML>
The HTML represents the entire document under the,
Four, Dom object gets the element node method 1.getElementById
A function specific to the Document object. document.getElementById (ID), ID corresponds to the ID value of the node element, denoted by the value of ID or the value of ID . The Change method returns an object
2.getElementsByTagName
getElementsByTagName is similar to getElementById, whose parameter is the name of the tag, and GCA wants to get the object labeled Li, which is document.getelementsbytagname ("Li"). The return type is an object array. Gets how many element nodes of a document can be used alert (document.getelementbytagname ("*"). Length). * is a wildcard character, representing all element nodes.
3.getElementByClassName
Getelementbyclassname is a new method for HTML5 that accesses elements through the type in the class attribute. Getelementbyclassname (Class) is similar to getElementsByTagName, and the return value is also an array with the same elements.
JavaScript Learning Summary (i) DOM Document Object model