文档介绍:javascript ,java真谛(javascript, java真谛)
Location of JS:
Header: make sure the script is loaded when it is called
Body: when the page is loaded, it is called
External JS file: does not contain <script> Tags
Usage: <script SRC = "" >.....</sceipt>
3, notes
Single: / /
Multi line:..*/ / *...
4, = = = symbol type and value congruence are equal
5, three kinds of prompt box
Warning: Alert ("alert");
Confirmation: confirm ("confirm");
Hint: prompt ("prompt", "default");
6, for in statement
For (variable in object)
{
Execute code here
}
7, regular expressions
Test () method: retrieves the specified value in the string, if there is a return True, otherwise False
Var patt1=new RegExp ("e");
( ("The best things in life free are");
Exec () method: retrieves the specified value in the character, if there is a value returned, otherwise returns null
Var patt1=new RegExp ("e");
( ("The best things in life free are");
Compile () method: used to change the retrieval mode and add and delete the second parameters
Detailed reference: icle/
(")"; output statement
notes / /
3. the traditional order of HTML documents is document->html-> (head, body)
4. the order of DOM in a browser window is window-> (navigator, screen, history, location, document)
5. get the name and value of the element in the form: (the ID number of the element in the form).Name (or value)
6. a lowercase to uppercase JS: ("output").Value = ("input"). ();
The value types in : String, Number, Boolean, Null, Object, Function
The character type in is converted into numeric type: parseInt (), parseFloat ()
The numbers in are converted into character types: ("+" variables)
The length of the fetch string in is: (length)
The characters in are connected to characters using the + number
Compari