JavaScript and HTML documents [summary]

Source: Internet
Author: User

The language structure of the client Javascript is consistent with that of the Javascript kernel. Client JavaScript defines a set of objects, methods, and property scripts. They interact with the XHTML document on the client.

Use JavaScript to access the element Dom address
Method 1: Document. Forms [0]. elements [0] (not commonly used, dom0)
Method 2: document.form1.txt name (commonly used, dom0, but does not comply with the xhtml1.1 Standard)
Method 3: Document. getelementbyid ("txtnameid") (optimal method, dom1 ,)

Register an event
The event has
Blur
Change
Click
Focus
Load
Upload
Mouseup
Mousedown
Mouseout
Mouseover
Mousemove
Select
Submit
Example:
Document. getelementbyid ("phone"). focous ();
Document. getelementbyid ("phone"). Select ();

Tag attributes (all event attributes must be in lower case)
1. onblur (<p>, <button>, <input>, <textarea>, <SELECT>)
2. onchange (<input>, <textarea>, <SELECT>)
3. onclick (<a >,< input>)
4. onfocus (<a >,< input >,< textarea >,< SELECT>)

5. onload (<body>)
6. onUnload (<body>)

7. onmousemove (most elements)
8. onmouseout (most elements)
9. onmouseover (most elements)
10. onmouseup (most elements)
11. onmousedown (most elements)

12. onselect (<input>, <textarea>)
13. onsubmit (<form>)

Method 1: Write onclick = "checkform ()" in the element ()"
Method 2: for example, document. getelementbyid ("form1"). elements [0]. onclick = "checkfrom" in the Javascript flag is written after the checkfrom method and form1 form.

 

Navigator object
Browser name: navigator. appname
Browser version: navigator. appversion

 

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.