Change bg color on load

by Alex Fogarty

HTML

JavasScript for Designers

JavaScript

/* Declare what's there - Nothing we're changing is on page so no need to declare*/


/* Say the way  - Window object has an onload event  So onload the function changeColor runs*/
window.onload = changeColor;

/* run the fun*/
function changeColor(){
document.body.style.backgroundColor = "Red";
}