javascript - Loading Image into document.body Background -
I am trying to draw an image (in this case, My code is so far: I believe you can remember two things. / camera / frame , Which is a well-known JPG), and it is loaded as the backdrop of its
document.body .
Miscellaneous background image = new image (); BackgroundImage.onload = function () {console.log ("Onload"); Document.body.style.backgroundImage = this.src; }; BackgroundImage.src = 'camera / frame'; Expected as
"Onload" , and this prints the entire URL to
/ camera / frame Still
remains Document.body.style.backgroundImage
"" .
var path = 'path / to / image.jpg'; Document.body.style.background = 'url (' + path + ')';
Comments
Post a Comment