I have this code from a website in which they changed the background image. I would like to use the old background image, but not sure how to. Original code from website:
<div style="position: absolute; top: -696px; left: -964px; width: 2944px; height: 1840px; transform: scale(1); transform-origin: 0px 0px; background-image: url("http://prodcdngame.lordofultima.com/cdn/377714/resource/webfrontend/townlayer/texture_bg_tile_big_city.jpg");">
Original code XPath = /html/body/div/div/div/div/div/div/div/div/div/div/div
so far I have this, but it only changes the background of the page during loading bar:
document.body.element.style.background = 'url("http://prodcdngame.lordofultima.com/cdn/377712/resource/webfrontend/townlayer/texture_bg_tile_big_city.jpg")';
My question is this - how do I rework my GM script so that it is applied to the specific div? OR How can i change just one character in the existing code (377714 to 377712)
As long as the image you want to use is in the same folder as texture_bg_tile_big_city.jpg you can just change that file name.
If you want to modify your script to only set the background image on one div you will have to add an ID to the div (if you don't already have one).
document.getElementById(NameOfID).style.backgroundImage = 'url("http://prodcdngame.lordofultima.com/cdn/377712/resource/webfrontend/townlayer/texture_bg_tile_big_city.jpg")';
There are two different ways to change a background image CSS with jQuery
Look carefully to note the differences. In the second, you can use conventional CSS and string multiple CSS properties together.
document.getElementById('a').style.backgroundImage="url(images/img.jpg)"; // specify the image path here
Hope it helps!