PDA

View Full Version : about background images



tetrix
10-23-2008, 01:15 PM
hello
would it be possible to call two or more background images in a simple javascript call like:

document.getElementsByTagName("body")[0].style.backgroundImage = "url(jour.gif)";
document.getElementsByTagName("body")[0].style.backgroundRepeat="no-repeat";
(here i only call one BG), but how two call multiples with javascript?,
(i know that is possible but thru css call)

jscheuer1
10-23-2008, 03:59 PM
Yes but there can only be one value per element for the backgroundImage property at a time. So any assignment to it will replace the previous one.

Are you trying to rotate background images? If so, you can. If you want two background images at the same time, you would need to superimpose two elements upon each other and give one background image to the first and the other background image to the second. But even then, unless the images had transparency or different sizes, positions, etc., the one 'on top' would completely cover the other.

tetrix
10-23-2008, 07:09 PM
hi, no, im just trying to update two different background images on the background element/object in one call, as i see it is not possible.