Trying to make a timer. This runs onload but gets browser error something like script might take to much time and gives choice to continue or not.
Got a "recursive" one working but have been told to avoid recursion.
What am I doing wrong ?
<script>
function a()
{
var m1,m2=new Date()
,t1=m1.getTime()
,t2=t1;
while (t2-t1<3000)
t2=m2.getTime();
alert('while over')
}
</script>
Got a "recursive" one working but have been told to avoid recursion.
What am I doing wrong ?
<script>
function a()
{
var m1,m2=new Date()
,t1=m1.getTime()
,t2=t1;
while (t2-t1<3000)
t2=m2.getTime();
alert('while over')
}
</script>