Prev Demo
JavaScript
>
Setinterval
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>setInterval</h1> <p>Click the below button to alert for every 4 seconds.</p> <input type="button" value="Alert" onclick="Function()" /> <p>The alert box repeats for every 4 seconds.</p> <script> function Function() { setInterval(function () { alert("Warning!"); }, 4000); } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output