javascript - Change jQuery elements into div? -
how change window in window.changecolour
call division id instead of window? thanks
window.changecolour = function(value) { switch(value) { case 'b': color = "#ff0000"; break; case 'r': color = "#0000ff"; break; case 'p': color = "#ff00ff"; break; } document.body.style.backgroundcolor = color; }
here html:
<div id= "genre"> <br><br> <p> <input type="radio" name="music" value="radio" onclick="changecolour('b')">blues <br> <input type="radio" name="music" value="radio" onclick="changecolour('r')">rock <br> <input type="radio" name="music" value="radio" onclick="changecolour('p')">pop <br> </p> </div>
if mean element id division
, , change it's colour, here's get
demo
var div = document.getelementbyid("division") div.changecolour = function(value) { switch(value) { case 'b': color = "#ff0000"; break; case 'r': color = "#0000ff"; break; case 'p': color = "#ff00ff"; break; } div.style.backgroundcolor = color; }
Comments
Post a Comment