Jump to content

help with clock script.


shedokan

Recommended Posts

why do I get " ; is needed at line 13"?

<html>
<head>
<script type="text/javascript">
<!--
var time = new Date();
var hours = time.getHours();
if (hours < 10){hours = "0" + hours;}
var minutes = time.getMinutes();
if (minutes < 10){minutes = "0" + minutes;}
var seconds = 5; //time.getSeconds();
if (seconds < 10){seconds = '0'+seconds;}
function clock() {
seconds = eval(seconds+"+0.5");

if (seconds < 10){seconds = '0'+seconds;}

if (seconds > 59){minutes = eval(minutes + "+1");
if (minutes < 10){minutes = "0" + minutes;}
seconds = eval(seconds + "-60");}

if (minutes > 59){
hours = eval(hours + "+1");
if (hours < 10){hours = "0" + hours;}
minutes = eval(minutes + "-60");
}

if (hours > 23){hours = eval(hours + "-24");}

document.getElementById("clock").innerHTML = hours + ":" + minutes + ":" + Math.round(seconds);
setTimeout("clock()",500);
}
//-->
</script>
</head>
<body onload="clock()">
<div id="clock"></div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/80517-help-with-clock-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.