carolineartz
3/8/2014 - 3:14 PM

manipulating css with javascript From http://docs.webplatform.org/wiki/tutorials/manipulating_css_with_javascript

// JavaScript demonstration
 
var square = document.getElementById("square"),
    clickMe = document.getElementById('clickMe'); //Keeping it unobstrusive
function doDemo () {
 
  var button = this;
  square.style.backgroundColor = "#fa4";
  button.setAttribute("disabled", "true");
  setTimeout(clearDemo, 2000, button);
}
 
function clearDemo (button) {
  var square = document.getElementById("square");
  square.style.backgroundColor = "transparent";
  button.removeAttribute("disabled");
}
 
clickMe.onclick = doDemo; //Onclick call. Pass no arguments.​​​​​