A, the BOM:
1. Concept: Browser Object Model browser object model
* the various components of the package browser into an object.
2. Composition:
* Window : window object
* Navigator : Object Browser
* Screen : Display screen objects
* History : History Object
* the Location : Address Bar Object
2.1 Window: window object
. 2.1.1 Creating
2.1.2 Method
1. and method popup related:
alert () to display a warning message box with a period and a confirmation button.
confirm () displays a dialog box with a message and the confirmation period and a cancel button buttons.
* If the user clicks the OK button, the method returns true
* If the user clicks the Cancel button, the method returns false
prompt () display can prompt the user to enter the dialog box.
* Return value: Gets the value entered by the user
2. Open and close the related method:
use Close () to close the browser window (who call me, who I closed)
Open () to open a new browser window (returns a new Window object )
3. the timer associated with the embodiment
setTimeout () call function or a calculation expression after a specified number of milliseconds.
* Parameters:
1. JS code or method of the object
2. The values ms
* Return Value: a unique identifier for the timer to cancel
the clearTimeout () to cancel the timeout setTimeout () method provided.
setInterval () at a specified interval (in milliseconds) to the calling function or calculation expression.
clearInterval () to cancel timeout by the setInterval () settings.
2.1.3 attribute:
1. Obtain other objects BOM:
History
LOCATION
Navigator
Screen:
2. DOM object get
the Document
2.1.4 features.
* Window objects do not need to create a window can be used directly use. window method name ();.
* reference window may be omitted. Method name ();
2.2 Location: the address bar objects
. 2.2.1 created (acquired):
1. window.location
2. LOCATION
2.2.2 Method:
* reload () reload the current document. Refresh
2.2.3 Properties
* href Sets or returns the full URL.
2.3 History: history object
. 2.3.1 created (acquired):
1. the window.history
2. history
2.3.2 Method:
* the Back () to load a URL before the history list.
* Forward () to load the next URL history list.
* Go (parameters) to load a specific page history list.
* Parameters:
* positive number: forward a few history
* Negative: Back a few historical record
2.3.3 attribute:
* URL length Returns the number of the current window history list.
Two, the DOM:
* Concept: Document Object Model Document Object Model
* The various components of the markup language document, encapsulated as an object. Dynamic operation can use these objects, the markup language document to the CRUD
* W3C DOM standard is divided into three distinct parts:
1. Core DOM - standard model for any structured document
* Document: Document Object
* Element: element object
* attribute: attributes of the object
* text: text object
* comment: annotation objects
* node: node object, the other five of the parent object
2.XML DOM - standard model for XML documents
3.HTML DOM - standard model for HTML documents
* core DOM model:
* the document: document Object
1. Create (acquisition): may be used in html dom window object model to obtain
1. the window.document
2. Document
2. Method:
1. Get an Element object:
1. the getElementById (): Get the object based on the id attribute value of the element. id attribute value is generally unique
2. getElementsByTagName (): Gets the element objects are based on the element name. The return value is an array
3. getElementsByClassName (): Gets the element object property values are based on Class. The return value is an array
4. getElementsByName (): Get the object elements according to their name attribute value. The return value is an array
2. Create other DOM objects:
createAttribute (name)
createComment ()
createElement ()
createTextNode ()
3. Properties
* Element: element object
1. Get / create: to capture and create through the Document
2. Method:
1. removeAttribute (): Delete Attribute
2. setAttribute (): set the properties
* the Node: node object , the other five parent object
* features: All dom object can be considered to be a node