touque.ca > Education Commons > Website Design > Scripting: Simple Javascript > Change body style > Add form element
Click a button to change the style of the body.
How it’s done:
function changeBodyClass(newStyle) { var element = document.getElementById("body"); element.setAttribute("class", newStyle); } // end of function changeBodyClass()
touque.ca > Education Commons > Website Design > Scripting: Simple Javascript > Change body style > Add form element