Forum Moderators: open

Message Too Old, No Replies

real time clock without a text input field?

         

partha

11:51 pm on Jan 12, 2005 (gmt 0)

10+ Year Member



Of course it's easy to make javascript display the current time (and update it as it changes) in a text input box, but what about without one? Can the time be displayed just as some text inside a <div>?

Birdman

11:57 pm on Jan 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Give the container element an id and then you can use the innerHTML method.

<script>
var now;
// time functions here then use below to write it

document.getElementById('time').innerHTML = now;
</script>

<p id="time"></p>