In JavaScript we can call recursively any function at a particular interval by using setInterval() method of window object. Here is the syntax
setInteval('function_name', time-millisecond, lang);
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 ) .

Demo of SetInterval

Here is the code.
<title>Demo of SetInterval JavaScript function</title>
<script language=javascript>

function to_start(){

function disp(){
var dt= new Date();
var str=dt.toTimeString()

<body >

<input type=text id=n1 >
<input type="button" name="btn" value="Start" onclick="to_start()";>
Above code we will only display the change in time but we can't stop it.
Visitors Rating
Your Rating



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

Post your comments , suggestion , error , requirements etc here .

HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 All rights reserved worldwide Privacy Policy Disclaimer