Give the cell a name, like this:
Code:<table>
<tr><td id="clock"></td></tr>
</table>
Then insert the current date and time into the cell with the following line of code (only works in IE):
Code:document.all["clock"].innerText=(new Date());
If you need to it continually update, simply set an interval for it with the window.setInterval() method.
Incidentally, this will work with almost any object in a web page that can contain HTML, like a DIV or a SPAN.
If you need it to work in Netscrape 4.x, I'd use an INPUT box instead and set it like this:
Code:document.formName.elementName.value=(new Date());
Hope that helps.
Enter your message below
Sign in or Join us (it's free).