legal ECMA-262 octal constant
Posted: Tue Aug 07, 2012 6:38 am
The error Message:
[syntax=javascript]
SyntaxError: 08 is not a legal ECMA-262 octal constant
[/syntax]
I try to put (int), but its does not seem to help, and sins i dont know allot about java, ill just post it here
Any help would be welcome tho
The code:
[syntax=php]<?php
$hour = (int)date("H", time());
$min = (int)date("i", time());
$sec = (int)date("s", time());
?>[/syntax]
[syntax=javascript]<script type="text/javascript">
function clockon(hour, min, sec) {
hours= hour
minutes= min
seconds= sec
seconds++;
if (seconds==60) {
seconds = "0";
minutes++;
}
if (minutes==60) {
minutes = "0";
hours++;
}
if (hours==24) hours = "0";
if (eval(hours)<10) {hours="0"+hours}
if (eval(minutes)<10) {minutes="0"+minutes}
if (eval(seconds)<10) {seconds="0"+seconds}
document.getElementById('txtTime').innerHTML= hours + ":" + minutes + ":" + seconds;
setTimeout("clockon("+hours+","+minutes+","+seconds+")",1000);
}
</script>
<span name='txtTime' id='txtTime'></span><br><?php echo date("F d, Y", time())?>
<script>clockon('<?php echo $hour; ?>', '<?php echo $min; ?>', '<?php echo $sec; ?>')</script>[/syntax]
[syntax=javascript]
SyntaxError: 08 is not a legal ECMA-262 octal constant
[/syntax]
I try to put (int), but its does not seem to help, and sins i dont know allot about java, ill just post it here
Any help would be welcome tho
The code:
[syntax=php]<?php
$hour = (int)date("H", time());
$min = (int)date("i", time());
$sec = (int)date("s", time());
?>[/syntax]
[syntax=javascript]<script type="text/javascript">
function clockon(hour, min, sec) {
hours= hour
minutes= min
seconds= sec
seconds++;
if (seconds==60) {
seconds = "0";
minutes++;
}
if (minutes==60) {
minutes = "0";
hours++;
}
if (hours==24) hours = "0";
if (eval(hours)<10) {hours="0"+hours}
if (eval(minutes)<10) {minutes="0"+minutes}
if (eval(seconds)<10) {seconds="0"+seconds}
document.getElementById('txtTime').innerHTML= hours + ":" + minutes + ":" + seconds;
setTimeout("clockon("+hours+","+minutes+","+seconds+")",1000);
}
</script>
<span name='txtTime' id='txtTime'></span><br><?php echo date("F d, Y", time())?>
<script>clockon('<?php echo $hour; ?>', '<?php echo $min; ?>', '<?php echo $sec; ?>')</script>[/syntax]