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