OneStopTesting.com - Testing EBooks, Tutorials, Articles, Jobs, Training Institutes etc.
OneStopGate.com - Gate EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopMBA.com - MBA EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopIAS.com - IAS EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopSAP.com - SAP EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
OneStopGRE.com - of GRE EBooks, Tutorials, Articles, FAQs, Jobs, Training Institutes etc.
How to set delay time in JavaScript | Articles | Recent Articles | News Article | Interesting Articles | Technology Articles | Articles On Education | Articles On Corporate | Company Articles | College Articles | Articles on Recession
Home » Articles » How to set delay time in JavaScript
How to set delay time in JavaScript
Article Posted On Date : Saturday, March 24, 2012
How to set delay time in JavaScript
Advertisements
Introduction: In this article you will learn how the delay time is being set in JavaScript. Timeouts are like a timer. It can allow you to execute a section of code after a specified amount of time has passed. If any user wants to display the output after some time then you will set time as follows: Syntax: setTimeout("function expression",delaytime) The delaytime is entered as milliseconds (1 second=1000 millisecond). Example: In this example you will see how to display an alert box automatically after some time. <html> <head> <title>Time in alert box</title> </head> <script type="text/javascript"> function timedMsg() { var t=setTimeout("alert('Welcome to dotnetheaven.com')",4000) } </script> <body> <input type="button" value="Display Timed alertbox!" onClick = "timedMsg()"> <form> <p> <font color="maroon"> Click on the button. An alert box will be displayed after 4 seconds. </font> </p> </form> </body> </html> Once the button is activated, the OnClick event goes to the function called "timedMsg". The function creates an ALERT box to appear after 4 seconds.
Amazon.in Widgets