I'm trying to figure out the html tag in order to change the background image, but I keep getting an error that says: "TypeError: document.html is undefined."
Here's the code I've been using:
function init(){
document.html.style.background ="url('175541_DSC_0291.JPG') no-repeat center center";
}
window.onload = function(){
init();
}
I searched for similar questions online and found something about using the body tag instead of HTML. When I changed it to body, it worked perfectly.
On top of that, I can easily set the HTML background to what I want using my CSS file, but I really want to achieve this with JavaScript. Any thoughts on why this isn't working?
Thanks in advance, George