April 17 Summary

Source: Internet
Author: User

First, BOM
1, window{
document{
Anchors
Forms
Images
Links
Location
}
Frames
History
Location
Navigator
Screen
}
2. Timer
function Execute () {
Console.info ("Execute Function! ");
}
Put a named function
SetTimeout (execute, 1000);
in milliseconds.
3, Setlnterval (interval execution)
SetInterval can also execute references that are placed into the execution code or named functions
SetInterval (function () {
Console.info ("Execute Function! ");
}, 1000);
4. Alert (Popup dialog box)
5, confirm (OK or cancel, and return a Boolean value.) )
6, Prompt (input box)
7. Open
8, Window.close
9. Access the specified URL (location.href = "https://www.baidu.com";)
10, history{
History.back ();//Return to previous page
History.foward ();//Enter the next page
History.go (-1);//Return to previous page
}
11. Get Client screen information (Window.screen object)
Window.screen.height screen height, in pixels.
Window.screen.width the screen width in pixels.
Window.screen.availHeight can use the screen height, not including toolbars, etc., in pixels.
Window.screen.availWidth can use the screen height, in pixels.
Second, DOM
1. DOM node type
Document node documents-root node.
Document type Node DOCUMENTTYPE-DTD reference is <! Doctype>.
Elements node element-tag.
Text node-text in a label or plain text contained within a cdatasection.
Attribute node Attr-the attribute of the element.
Cdatasection-is usually the parent class of the text node and the comment node.
Comment Node Comment-comments.
2. Node properties and methods
NodeName the name of the String node
One of the type constants of the NodeType number node
FirstChild the first node in the node ChildNodes list
LastChild the last node in the node ChildNodes list
ChildNodes List of NodeList nodes
PreviousSibling node before a sibling
NextSibling node after a sibling nodes
AppendChild (node) node adds node to the end of ChildNodes
InsertBefore (NewNode, Refnode) node inserted refnode before newnode in ChildNodes
RemoveChild (node) node removes node from childnodes
ReplaceChild (NewNode, OldNode) Node replaces OldNode in childnodes with NewNode

3. Get the Node
A. Acquiring nodes using node relationships
ChildNodes-Gets all child nodes.
FirstChild-Gets the first child node.
LastChild-Gets the last child node.
PreviousSibling-Gets the previous sibling node.
NextSibling-Gets the next sibling node.
ParentNode-Gets the parent node.
B. Get the node directly
document.getElementById ("id")-Gets the node by ID.
document.getElementsByTagName ("div")-Gets the node based on the tag name.
Document.getelementsbyclassname ("class")-Gets the node based on the class name.
Document.getelementsbyname ("name")-Gets the node by name.
4. Nodes created
1. Create a new node
createelement ("div")-Creates the element node of the Div.
createTextNode ("text")-Creates a text node that contains "text".
For example:
Document.createelement ("P");
document.createTextNode ("haha");

April 17 Summary

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.