In above code function_name is the name of the function we want to execute at an interval of time-millisecond ( time in mill second ) , optional element lang we can specify the code we want to execute.
Let us start displaying current time by using toTimeString() function. We will keep display part inside a function disp() . Using setInterval method we will call disp() function in every one second ( 1000 millisecond ) .
Here is the code.
<html>
<head>
<title>Demo of SetInterval JavaScript function</title>
<script language=javascript>
function to_start(){
tm=window.setInterval('disp()',1000);
}
function disp(){
var dt= new Date();
var str=dt.toTimeString()
document.getElementById('n1').value=str;
}
</script>
</head>
<body >
<input type=text id=n1 >
<input type="button" name="btn" value="Start" onclick="to_start()";>
</body>
</html>
how to get a alert message with the reference of table data id using javascript?
Note: if i clicked one row and the alert box will be triggered with that row information... can u please help me???? for this question? i need soon back
✖
We use cookies to improve your browsing experience. . Learn more