document.body.style.backgroundImage = 'url code example
Example: set attribute javascript background image
document.body.style.backgroundImage = "url('img_tree.png')";
document.body.style.backgroundImage = "url('img_tree.png')";