+ 6
How can we change the background color of our page using javascript .
I want to change the background color of the page but it doesn't work . The JavaScript code is : code = "ff0ce7"; change = document.getElementById('test'); change.bgcolor = code; Why does it not works . Plz help
2 Respostas
+ 6
try this trick
js part:
function changeBackground(color){
document.body.style.background;
}
html part:
<body onload="changeBackground('red')">
+ 3
thanks but I want to add a random color code . How can I do that .