Dom document object model

Source: Internet
Author: User

1. Events
Body event
Onload onunload onbeforeunload
Common events
Onclick, ondblclick, onkeydown, onkeypress, onkeypress, onkeyup, onmousedown, onmousemove) onmouseout, onmouseover, onmouseover, and onmouseup

2. dynamically setting events is similar to registering events in net.
Document. ondbclick = f1; // set the event handler function of document. ondbclick to f1.
3. The current browser window of the window object upload handler Doc ument. body
Method
Alert ()
Confirm ("OK? ")
Navigate ("http://www.baidu.com ");
Var timerId = setInterval ("alert ('hello')", 500 );
ClearInterval (timerId)
SetTimeout ()
ClearTimeout ()
ShowModalDialog ("window.htm") mode form
ShowModelessDialog ("window.htm") Non-modal form
Attribute
Window. location. href
Window. location. reload () refresh the page
Window. event
AltKey
CtrlKey
ShiftKey
ReturnValue cancels subsequent content execution
Event source caused by srcElement
Key value when keyCode triggers an event
When a button triggers an event, the mouse key 1 is the left button, 2 is the right button, and 3 is the left and right keys at the same time.
Screen Resolution
Width
Height
ClipboardData clipboard
GetData ("Text ")
SetData ("Text", val)
ClearData ("Text ")
History
Back () go (-1)
Forward () go (1)
Document
Method
Write ()
Writeln ()
GetElementById ()
GetElementsByName ()
GetElementsByTagName ()
CreateElement ()
AppendChild ()
4. Get Element Content
Value
InnerText
InnerHTML
5. dynamically modify element styles
This. style. backgroundColor
This. style. fontSize
This. style. marginTop
This. style. display = "none" hide "" display
This. style. width = "18px"

6. form object
Event
Onsubmit
Method
Submit ()

Related Article

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.