Click to See Complete Forum and Search --> : loop/timeout questions


Bungholio
08-09-2003, 01:10 AM
Hey, thanks for looking,

Ive got a simple time script from a site, it writes the current time to a layer. this is the script

<SCRIPT LANGUAGE="JavaScript">
function displaydatetime() {
if (!document.layers && !document.all) return;
var myDate = new Date();
var myMinute = myDate.getMinutes();
var mySeconds=myDate.getSeconds()
if (document.layers) {
document.layers.clockLocal.document.write(myMinute+':'+mySeconds);
document.layers.clockLocal.document.close();}
else if (document.all) {
clockLocal.innerHTML = myMinute+':'+mySeconds;}
setTimeout("displaydatetime()", 500)
}
window.onload = displaydatetime;
</script>

pretty simple really, i understand it. every half second it writes the current minute & second to a layer called 'clockLocal'

however, i want to simplify it quite a bit more, but i cant seem to get it working, all i want to do is remove all the layer stuff

<SCRIPT LANGUAGE="JavaScript">
function displaydatetime() {
var myDate = new Date();
var myMinute = myDate.getMinutes();
var mySeconds=myDate.getSeconds()
document.write(myMinute+':'+mySeconds);
setTimeout("displaydatetime()", 500)
}
window.onload = displaydatetime;
</script>

however i get an error with that :-\

any help is greatly appreciated :) :) thanks, Al

Bungholio
08-09-2003, 03:40 AM
ok forget this quesiton, i got it

DELETE this thread :)