hi, i’m a student newbie and i have an excercise, which displays two counters from 0 to infinity. i can get it to count only to 1 then it stops. i have tried calling the function again immediately after it has incremented by 1 to get it to keep going, but i’m having problems. at first i used a for loop, then seen that there was no need, i think, so if you can help i would appreciate it right now.
thanks in advance.
here’s the code:
<html>
<head>
<title>Dynamic HTML</title>
<script language=javascript>
var count1=0;
var count2=0;
function counters()
{
setInterval(“counter1(count1)”,1000);
setInterval(“counter2(count2)”,100);
}
function counter1(count)
{
myPara1.style.color=”red”;
myPara1.innerText=++count;
}
function counter2(count)
{
myPara2.style.color=”green”;
myPara2.innerText=++count;
}
</script>
</head>
<body>
<h1 align=center>Dynamic HTML</h1>
<a href=”” onMouseOver=counters()>Move the mouse over here to begin</a>
<p id=myPara1 align=center>Counter 1</p>
<p id=myPara2 align=center>Counter 2</p>
</body>
</html>