I am unable to debug the following code. I can't find any errors here.
I am getting the button but after clicking on it, only Time Remaining: 10000 msecs is being displayed.
In Firefox 2.0.0.3: I checked the error console, it shows timedCount is not defined on line t = setTimeout("timedCount()",200)
IE 7 : gives
Line: 1
Char: 1
Error: Object Expected
Code: 0
I also tried an example of setTimeout() from a website, it worked properly.
<html>
<head>
<script type="text/javascript">
var rem=0
var t
function startT(t)
{
rem = t
timedCount()
}
function timedCount()
{
if(rem==0)
{
document.write("Time Over.<br>")
return
}
document.write("Time Remaining: " + rem + " msecs.<br>")
rem = rem - 1
t = setTimeout("timedCount()",200)
}
</script>
</head>
<body>
<br>
<input type="button" value="Start" onClick="startT(10000)">
</body>
</html>
Please help.