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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TD background in firefox

    I'm trying to dynamically change the background of a <TD> using javascript and it works in IE, but not firefox. Any suggestions would be much appreciated, here are some snippets.

    The html looks like this

    <TR height=24>
    <TD class=topiclefttext id="Newstopic001"
    background="lpnet_files/forumleft.gif" colSpan=2>....</TR>

    my javascript looks like:

    document.getElementById("Newstopic001").background = imagePath

    in IE this works, but in firefox it doesn't.

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,522
    Thanks
    3
    Thanked 508 Times in 495 Posts
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    </head>
    
    <body>
    <table cellpadding="0" cellspacing="0" border="1">
    <tr>
    <td width=200" style="background-image:url(http://www.vicsjavascripts.org.uk/StdImages/One.gif);"
    onclick="this.style.backgroundImage='url(http://www.vicsjavascripts.org.uk/StdImages/Two.gif)';"
     >1234</td>
    </tr>
    </table>
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/


  •  

    Posting Permissions

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