mytime is the identifier used to identify the current timeout function.
expression is the statement that is to be executed after the specified time has ticked off.
msec is the duration of time in milliseconds after which the expression will be executed.
You can see by using setTimeout function we can execute any function or object after a set of time. For example if msec is set 5000 then the expression will be executed after 5 seconds or 5000 milliseconds.
We will try one example where we will have four period buttons and each button will set a different time for another function to execute and display a alert button. We will call it as a reminder script and we will get one alert box based on the period button we clicked. Note that we will be using onclick event of period button for this. Here is the demo and you will get alert message box based on the radio button you clicked.
No reminder After 2 Secs After 5 Secs After 10 Secs
Now here is the code to be used inside your head tags
This is the code we used for displaying the period buttons
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.