Home > Article > Web Front-end > js usage methods and functions summary_javascript skills
A summary of how to use js is quite good. It is good for both novices and veterans.
1 Create script block
1:
2 Hidden script code
1:
Relevant code will not be executed in browsers that do not support JavaScript
3 Displayed when the browser does not support it
1:
4 Link to external script file
1:
5 Comment script
1: // This is a comment
2: document.write("Hello"); // This is a comment
3: /*
4: All of this
5: is a comment
6: */
6 Output to browser
1: document.write("Hello");
7 Define variables
1: var myVariable = "some value";
8 String addition
1: var myString = "String1" "String2";
9 characters String search
1:
10 String replacement
1: thisVar.replace("Monday","Friday");
11 Format string
1:
12 Create array
1: < ;script language="JavaScript">
2:
11:
13 Array sorting
1:
14 Split string
1:
15 Pop-up warning message
1: 16 Pop-up confirmation box
1:
17 Define function
1:
27 Dynamically output HTML
1:
28 Output newline
1: document.writeln("a");
2: document.writeln("b");
29 Output date
1:
31 Set date output format
1:
32 Read URL parameters
1:
Do you still think HTML is stateless?
33 Open a new document object
1:
34 page jump
1:
35 Add web page loading progress window
1:
2:
This is the main page