shedokan Posted December 6, 2007 Share Posted December 6, 2007 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 More sharing options...
BenInBlack Posted December 6, 2007 Share Posted December 6, 2007 you must have not read the top tip, that has a link that.... (second pass) tell you the using EVAL() is EVIL. ;-) minutes = eval(minutes + "-60"); you dont need to use eval here. just minutes = (minutes - 60); Link to comment https://forums.phpfreaks.com/topic/80517-help-with-clock-script/#findComment-408211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.