Problem with Javascript & Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daschicken
    New Member
    • Jan 2008
    • 14

    Problem with Javascript & Firefox

    Hi,

    ive got the following functions included in my page. with IE they are perfectly working. with firefox it seems like they are not there at all ...

    Code:
    function img_toggle(img) {
        var img = document.getElementById("img" + img);
        img.background = "bg/t2.gif";
        img.style.cursor = "hand";
    }
    
    function img_toggleback(img) {
        var img = document.getElementById("img" + img);
        img.background = "bg/t1.gif";
        }
    the sourcecode of FF shows the following

    Code:
    <a href="index.php?id=neuen"><td height="40" class="link" align="left" background="bg/t2.gif" id="img1" onMouseOver="img_toggle('1')"  >&nbsp;&nbsp;neueste Beiträge</td></a>
    anybody any idea why this is so?
    thanks very much in advance.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    There's no background property for table cell (td) tags. See the standard.

    Use the tdref.style.bac kgroundImage property instead.

    Comment

    • daschicken
      New Member
      • Jan 2008
      • 14

      #3
      thanks,
      ill try it :)

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Let us know if you manage to get it working.

        Comment

        • daschicken
          New Member
          • Jan 2008
          • 14

          #5
          hi,

          just as I was about to try it, i got another idea which works perfectly now.

          I just did it with css and lists, completely without js. I recon its way better because theres less code and its more flexibel.

          but thanks for your answer anyway :)

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by daschicken
            I just did it with css and lists, completely without js. I recon its way better because theres less code and its more flexibel.
            Oh, of course! It'll also work even if JavaScript is turned off.

            Glad you managed to solve it. Post again if you have more JavaScript queries.

            Comment

            Working...