in the Web page in the JS function to automate the use of three methods, the following for you to describe the details of JS to take the request value and automatic implementation of the use, the need for friends can refer to the following
JS function in the Web page in the automatic execution of three methods commonly used in the head region of HTML, there are the following functions: code as follows: <script language= "JavaScript" > functionn Myautorun () { //Below is the code for your function, please modify it first! Alert ("Function automatic execution Oh!") "); } </SCRIPT> Below, we aim at the above function and let it run automatically when the page is loaded! ① the first method change the above code to: code as follows: <script language= "JavaScript" > functionn myautorun () { //Below is the code for your function, please change it first! Alert ("Function automatic execution Oh!") "); } Window.onload=myautorun (); Just add this sentence </SCRIPT> ② The second method modify the page's body for: code as follows: <body onload= "Myautorun ();" > or change to: code as follows: <body onload= "Javascript:myautorun ();" > ③ The third method use the JS timer to intermittently execute the function: copy code code as follows: SetTimeout ("Myautorun ()", 1000); Execute the Myautorun () function Implementation method once every 1000 milliseconds, change the top JS function to: code as follows: <script language= "JavaScript" > Functionn Myautorun () { //Below is the code for your function, please change it first! Alert ("Function automatic execution Oh!") "); } settimeout (" Myautorun () ",1000); In this way the line pull </SCRIPT> Other methods are more special, also not commonly used, versatility is not very large, do not introduce! JS can also use the el& jstl code as follows: var step = "<c:out value= ' ${step} ' default= ' 0 '/>"; switch (step) {&nbs P Case "0": default: break; var step = "<c:out value= ' ${step} ' default= ' 0 '/>";