...

View Full Version : Clock not displaying in text field.



SpiritualStorms
08-10-2004, 05:44 AM
I have the following script:



function liveclock() {

var curdate = new Date();

var hours=curdate.getHours();

var minutes=curdate.getMinutes();

var seconds=curdate.getSeconds();

var suffix="AM"

var box=document.tee_One.tee_Two;

if (hours>=12){
suffix="PM";
if (hours>=13)
hours-=12
}

if (minutes<10)
minutes= "0" + minutes;

if (seconds<10)
seconds= "0" + seconds;

var thetime = hours+ ":" +minutes + ":" + seconds + " " +suffix;

box.value = thetime;

setTimeout("liveclock()",1000)
}

liveclock();

The thing is, nothing is displayed in the content box. And i get no errors.

glenngv
08-10-2004, 06:25 AM
Comment first the setTimeout line and then put alert statements in the function to see where the code goes wrong.

Something like:

var box=document.tee_One.tee_Two;
alert(box); //should alert [object] for IE



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum