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;

but to keep it simple ... you're just overwriting your value each iteration, you're not adding the next lines

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.