DIV

0 william appiah-dankwah · April 8, 2015
why can't you assign a statement more than once to a div?

Post a Reply

Replies

Oldest  Newest  Rating
+1 Luke Shimkus · April 13, 2015
Can you be more elaborate? 
+1 Luke Shimkus · April 14, 2015
You have to name your variables differently for each element so try this:


window.onload = function(){

obj = document.getElementById("Plane");

obj.style.width = "100px";
obj.style.background = "grey";
obj.style.padding = "5px";
obj.style.border = "2px solid black";
obj.style.textAlign = "center";

obj2 = document.getElementById("like");

obj2.style.width = "100px";
obj2.style.background = "pink";
obj2.style.padding = "5px";
obj2.style.border = "2px solid black";
obj2.style.textAlign = "center";

}
0 william appiah-dankwah · April 14, 2015

window.onload = function(){

obj = document.getElementById("Plane");

obj.style.width = "100px";
obj.style.background = "grey";
obj.style.padding = "5px";
obj.style.border = "2px solid black";
obj.style.textAlign = "center";

obj = document.getElementById("like");

obj.style.width = "100px";
obj.style.background = "pink";
obj.style.padding = "5px";
obj.style.border = "2px solid black";
obj.style.textAlign = "center";

}














0 william appiah-dankwah · April 14, 2015
your wrong! 
0 william appiah-dankwah · April 14, 2015
i think i may have given you the wrong example thats for a button and thats definitely wrong 
  • 1

Javascript

107,068 followers
About

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

Links
Moderators