Frontend Development

Stupid JS problem (still learning this)

Submitted by AAA, , Thread ID: 21709

Thread Closed

RE: Stupid JS problem (still learning this)

Jackz
Member
Prime
Level:
0
Reputation:
12
Posts:
147
Likes:
18
Credits:
79
10-06-2016, 11:16 PM
#4
10-06-2016, 11:13 PM
AAA Wrote:
10-06-2016, 10:59 PM
Jackz Wrote:
function foo() {
var colors = ["white", "red", "blue", "green"];
var color = document.getElementById("select").value;
var selection = document.getElementById("select").selectedIndex;
document.getElementById("p").innerHTML = "Your favorite color is: " + color;
document.body.style.background = colors[selection];
}

//This should work

Thank you so much, Mr. Robot ;D

No problem
Do notdispatchsuperfluousmemos to me
Contactme only ifyou are faced withgenuine conflictor ifyou are opposed to speaking with another
Act with forethoughtpriorto speakingor acting as I am not fond offorgiveness

Users browsing this thread: 1 Guest(s)