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> Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.