Prev Demo
Displaying The Time In Seconds In Text Box.
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Displaying the time in seconds in text box</h1> <p>Click the below button to know the seconds of time in text box.</p> <input type="button" value="Click Here" onclick="myText()"/> <input type="text" id="myId"/> <script> function myText() { var a = document.getElementById("myId"); setTimeout(function () { a.value = "1 seconds" }, 1000); setTimeout(function () { a.value = "2 seconds" }, 2000); setTimeout(function () { a.value = "3 seconds" }, 3000); setTimeout(function () { a.value = "4 seconds" }, 4000); setTimeout(function () { a.value = "5 seconds" }, 5000); setTimeout(function () { a.value = "6 seconds" }, 6000); setTimeout(function () { a.value = "7 seconds" }, 7000); setTimeout(function () { a.value = "8 seconds" }, 8000); setTimeout(function () { a.value = "9 seconds" }, 9000); setTimeout(function () { a.value = "10 seconds" }, 10000); } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output