GetElementById

+1 william appiah-dankwah · March 10, 2015

function Yellow(){

var Eight = 79;
var Sam = Eight + 8;
var Rink = "william"

for(i = 0; i < 10; i++){

var object = document.getElementById('Plane');

object.innerHTML = Sam * i;
object.innerHTML = Rink + "," + i;

}
}


my first getElementById that works with a loop still needs perfecting but try out the code any hints and tips welcome i am very happy with this

Post a Reply

Replies

Oldest  Newest  Rating
0 Filip Petrovic · March 14, 2015
You should avoid using object as a variable name.
You are assigning value to variable "object" ten times, that is unnecessary (for your example), so put it outside of a loop
0 william appiah-dankwah · March 15, 2015
the code does not run out side of the loop if you have tried it you will find the loop statement executes the code
  • 1

Javascript

107,277 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators