Results 1 to 3 of 3

Thread: about background images

  1. #1
    Join Date
    Nov 2007
    Posts
    24
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default about background images

    hello
    would it be possible to call two or more background images in a simple javascript call like:
    Code:
    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)

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2007
    Posts
    24
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •