Hi All,
When trying to change the bcackgroundImage of element useing javascript method style.backgroundImage="url(blue_link.gif) no errors found but the script can't find the image so what is the correct way to use the address of the image?


Thanks very much in advance,
Fred

Recommended Answers

All 2 Replies

For JavaScript questions you should post in the JavaScript forum, a subforum of Web Development.

Java != JavaScript.

Black Box

Post the proper code along with the directory structure. element.style.backgroundImage = "url(my_image.jpg)"; should work assuming that the image is present in the same directory as the html file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.