views:

39

answers:

1

Hi,

I would like to put a clock on my webpage which should show time and a timer for a particular interval.

Could you please suggest me some open source javascript to do that??

I tried unsuccessfully searching web for flash one's.

Please help.

Thanks, Mahesh

A: 

There is JavaScript function called SetInterval that allows you to pass a callback to be executed on a specified interval of time. You can use it in order to repeat a given action over a period of time. Here is an example:

 <script type="text/javascript">
    function doSomething() {
        alert('yahoo');
    }

    setInterval(doSomething, 500);

</script>

This will alert 'yahoo' оn every 500 miliseconds.

As for the clock, I suggest that you take a look at the following link

Genady Sergeev