Advanced Search

Results 1 to 3 of 3

Thread: js stopped working in FF4 and FF5, Safari5.1

  1. #1
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question js stopped working in FF4 and FF5, Safari5.1

    here's the URL: http://www.rabradbury.com/furntesting.html

    When mouseover on the small images at the base of the page, different text(s) and image(s) should
    appear above in the different tds. For some reason it's displaying everything despite the span and "hide".
    It worked fine in earlier browser versions. It's an old site (and I know it needs an upgrade) but it's a pro bono job for a senior who still works with his hands, and I work on it when I get a chance. This came as a surprise.

    I'm stuck after hours of trying to figure it out. Worked fine before FF4.

    THANKS in advance for any assistance.

    <script type="text/javascript" language="JavaScript">
    <!--

    // show and hide spans
    // Based on "Let Them Eat Cake" code from alistapart.com

    function hideSpans(exempt) {
    if (!document.getElementsByTagName) {
    return null;
    }
    if (!exempt) exempt = "";
    var spans = document.getElementsByTagName("span");
    for (var i = 0; i < spans.length; i++)
    {
    var span = spans[i];
    var id = span.id;
    if (id != exempt) {
    span.className = "hidden";
    }
    else {
    span.className = "shown";
    }
    }
    }

    //Start of rolloverimages

    function roll(img_name1, img_src1, img_name2, img_src2, img_name3, img_src3, img_name4, img_src4)
    {
    document[img_name1].src = img_src1;
    document[img_name2].src = img_src2;
    document[img_name3].src = img_src3;
    document[img_name4].src = img_src4;
    }

    //-->
    </script>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,677
    Thanks
    43
    Thanked 3,126 Times in 3,092 Posts
    Blog Entries
    12

    Default

    Works OK here in Firefox 5. Perhaps you have javascript disabled in your browser.
    - John
    ________________________

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

  3. #3
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    It's working in Firefox, Chrome, Safari and Opera.

    Internet Explorer is throwing errors and stopping the script because document[...] is undefined. If you remove the function roll() entirely (which appears to be irrelevant anyway), it should work fine in IE as well.

    Code:
    <script type="text/javascript" language="JavaScript">
    <!--
    
    // show and hide spans
    // Based on "Let Them Eat Cake" code from alistapart.com
    
    function hideSpans(exempt) {
    if (!document.getElementsByTagName) {
    return null;
    }
    if (!exempt) exempt = "";
    var spans = document.getElementsByTagName("span");
    for (var i = 0; i < spans.length; i++)
    {
    var span = spans[i];
    var id = span.id;
    if (id != exempt) {
    span.className = "hidden";
    }
    else {
    span.className = "shown";
    }
    }
    }
    
    //Start of rolloverimages
    
    function roll(img_name1, img_src1, img_name2, img_src2, img_name3, img_src3, img_name4, img_src4)
    {
    // Remove
    }
    
    //-->
    </script>

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
  •