change background js code example

Example 1: javascript change frame background

window.frames['frameName'].document.body.style.backgroundColor = "#000";

Example 2: JavaScript Change Background Color

var element = document.body;
element.style.backgroundColor = "blue";

Example 3: javascript change background color

function changeBackground(color) {
   document.body.style.background = color;
}

window.addEventListener("load",function() { changeBackground('red') });

Example 4: change background with js

document.body.style.backgroundColor = "red";

Example 5: set background color dynamically javascript

document.body.style.backgroundColor="white"

Example 6: change background with js

document.body.style.background;