Similar to my last post one of the exercises is to write an external JavaScript as below which produces the following output:
Iteration number: 1
Iteration number: 2
Iteration number: 3
Iteration number: 4
Iteration number: 5
Iteration number: 6
Iteration number: 7
Iteration number: 8
Iteration number: 9
Iteration number: 10
the problem is that I am only getting:
Iteration number: 10
function init()
{
var panel=document.getElementById("panel");
var i;
for (i=1; i<11; i++)
{
panel.innerHTML="Iteration number: "+i+"<br>";
}
}
window.onload=init;