window object:
Open and close windows:
window.open()
Three parameters: 1. Load the URL of the page in the new window
2. The name of the new window
3. Feature string and description whether to replace the Boolean value of the currently loaded page with the newly loaded page.
window.close()
System dialog box:
1.alert("hello world!");
2.confirm("Are you sure?");---Select
3.prompt("Your name means?","");
Time interval
setTimeout("alert('hello world!')", 3000) Execute hello world only once interval 3 seconds
cleanTimeout
setInterval("alert('hello world')".3000) executes every 3 seconds
CleanInterval
history
window.history.go(-1) Back to previous page
window.history.back Back to previous page
window.history.go(1) Go to one page
window.history.forward Go to a page
window.history.length query to see the number of pages in history
document object:
document.links[0]Access link
document.images[0] or document.images["imgHome"] access image
document.forms[0] or document.forms["frmSubscribe"] access form
Location object
href: The full URL of the currently loaded page
The most important nodes in the DOM:
1. Element node (Elenment);
2. Attributes;
3. Text node (Text);
4. Comment node;
Common methods for all types of nodes:
Find:
nodeName: node name
nodeValue: The value of the node (mainly for text nodes, if it is an element node, it is returned as null;)
nodeType: The type of node
firstChild:The first son****
lastChild: The second son****
childNodes: all child nodes*****(two ways)////
previousSibling: Point to the previous sibling node (same level **);
nextSibling: Point to the next sibling node (same level **);
operate:
attributes: Attr object containing the attributes of an element represented by it, only used in Element nodes
appendChild: Add a new node at the end
removeChild: Delete a node
replaceChild:Replace
insertBefore: Add a node before...
create:
createElement: Create an element node
createTextNode: Create a text node
clone:
cloneNode: replicate a node true (deep replication) false (shallow replication)
Access the specified node:
getElementById: Find the specified Id;
getElementsByTagName: Find the type of the specified element (form of an array);
getElementsName: Find the Name of the specified element;
Find, change, and set properties:
getArrtibute: property search;
setArrtibute: Change of attributes, for example: setArritate(class, red) The first parameter is to change class, and the second is to red;
removeAttibute: remove attribute;
Overwrite, add the value of the text:
innerHTML