Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    changing background image of a table

    hi
    i have the following:
    Code:
    <table id="table3" cellSpacing="6" width="100%" style="border: 1px solid #C2CFDF; background-color: #F0F5FA">
       <tr style="font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; color: #000">
       <td style="font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; color: #000">&nbsp;</td>
       <td align="right" style="font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; color: #000">&nbsp;</td>
      </tr>
    </table>
    i want to change the background image of the table to
    http://img.photobucket.com/albums/v2...deep89/asd.png
    (not a real image)

    i know i need something like:
    document.getElementById="table3".style.backgroundImage="url(http://img.photobucket.com/albums/v214/sandeep89/titlemedium.png)"

    this doesn't work, can anyone tell me where im going wrong please?
    thanks
    sandeep

  • #2
    Regular Coder
    Join Date
    Oct 2005
    Location
    Arizona
    Posts
    336
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your syntax is a little off.

    document.getElementbyId("table3").background="the url of the image goes here"

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    and use relative url, not absolute, as long as your picture belongs to the same domain with the page
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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