xxxxxxxxxx
// Access the element
var myElement = document.getElementById("myElement");
// Change the background color
myElement.style.backgroundColor = "red";
xxxxxxxxxx
// change background color for specific id ..
function changebackground(){
document.getElementById('id').style.backgroundColor = 'green' ;
}
// change background color for whole body..
function changebackground(){
document.body.style.backgroundColor = 'green';
}
xxxxxxxxxx
function changeBackground(color) {
document.body.style.background = color;
}
window.addEventListener("load",function() { changeBackground('red') });
xxxxxxxxxx
document.querySelector('html').style.backgroundColor = 'red';
xxxxxxxxxx
var warning = document.getElementById("warning");
warning.style.background-color = "red";
xxxxxxxxxx
function btn() {
event.stopPropagation();
}
var button = document.getElementById("btn");
button.addEventListener("click", function (e) {
e.target.style.backgroundColor = "green";
});
button.addEventListener("focusout", function (e) {
e.target.style.backgroundColor = "";
});
xxxxxxxxxx
// change background color for specific id ..
function changebackground(){
document.getElementById('id').style.backgroundColor = 'green' ;
}
// change background color for whole body..
function changebackground(){
document.body.style.backgroundColor = 'green';
}