JS fetch request value and automatically perform usage example

Source: Internet
Author: User

  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 '/>";   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.