What is JavaScript?
(1) JavaScript is a scripting language that is object-based (object) and event driven (driven) and has a secure performance.
(2) JavaScript is a scripting language developed by Netscape, whose programs can be embedded in HTML pages and interpreted directly in the browser.
(3) JavaScript can be directly interpreted by the browser execution, it can better reduce the server pressure, improve the efficiency of program operation.
Events (event monitoring):
The Label object. Event listener. Function () {Execute code, find object, find attribute, change attribute};
The event source. Invokes a method. method to find the execution code to find the object, find attributes, change attributes (or use attributes, additions and deletions to check)
onmouseover Mouse over an element
onmouseout mouse to remove an element
onkeydown Keyboard Press down (just keep pressing)
onkeypress Keyboard Press down and loosen (just click and then loosen)
Oonkeyup keyboard Release (when released)
OnClick Mouse Press down and up (click)
OnMouseDown mouse button Press (press not move)
OnMouseMove Mouse Movement (move and do not press the line)
onMouseOut the mouse over an element (when the mouse is put up)
OnMouseUp mouse button is released (when the mouse is loosened)
OnResize window or frame is resized
Window.onresize
OnSubmit form Submission
onblur Element loses focus
onfocus Element gets focus
Width and height of the browser's blank area (ie, the width and height of the browser)
Width: document.documentElement.clientWidth;
High: Document.documentElement.clientHeight;
How to get an object:
Window.document.getElementById (' Miao ');//window can omit
document.getElementById (' Miao ');//id is unique, not conflicting, so get an object value, not an array
document.getElementsByTagName ("a");//label name not unique get all a tag objects, generate arrays
Document.getelementsbyclassname ("a");//classname is not unique, gets all tag objects classname for a array
Document.getelementsbyname ("a");//name property is not unique, gets all tag objects named A, generates arrays
It's the whole label.
After getting the object, you can call the object's innerHTML property if you want to get the contents of the label
Label object. InnerHTML: Represents the text between tags
Label object. InnerHTML = new data: To assign a value to the contents of a label
Bomb frame:
Alert (): a regular window
Confirm (): Pop-up window with a confirmation and cancellation
Prompt (): Popup with Input box
settimeout (func,n)//timer, n seconds after executing the program in Func, the unit is milliseconds
Cleartimeout (s); Cancels the timer effect, and the parameter is the time identification of the settimeout generation
SetInterval (func,n): Perform something at a fixed time interval
Clearinterval (s);
String conversion numeric type parseint ();
var h =document.documentelement.clientheight;//gets a high browser
var w =document.documentelement.clientwidth;//get the browser's width
var div1 = document.getElementById ("id");//Get the object of the label with ID ID
Iw=parseint (W)//Turn W into numerical type
Ih=parseint (h)
div1.style.height=ih+ ' px ';//Assign Value
div1.style.width=iw+ ' px ';
This is the entire content of this article, I hope that you will be in the future in the project to use JavaScript tags and methods to help.