Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:51:20+00:00 2026-05-28T13:51:20+00:00

Firefox seems to be ignoring some JavaScript code in my program. The code below

  • 0

Firefox seems to be ignoring some JavaScript code in my program. The code below is used to change the background position of the element #navi li a, and the for loop that you see is part of a timer that changes images and text; as well as, the background position of the #navi (which is a sprite). The problem occurs when you get down to the condition if(j === count). Firefox recognizes the initial backgroundPosition property and sets the sprite to -12 pixels but when that element is no longer active. For a better idea of what happens the sprite is 11 x 24 pixels of two circles, the circle at 0 0 is yellow or active and the circle at 0 -12 is white or inactive. Firefox changes all of the circles to yellow as the timer goes but doesn’t reset them back to white when they are no longer active. The code for IE6 and Safari works as intended, Firefox is currently the only browser with this problem.

    for (j=1;j<4;j++){

    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
        var ieversion=new Number(RegExp.$1) 
        if (ieversion>=6){
            document.getElementById("navi"+j).style.backgroundPosition = "0 -12";                       
            document.getElementById("image_description"+j).style.visibility = "hidden";
        }
    } else if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ 
        var ffversion=new Number(RegExp.$1)
        if (ffversion>=3){
            document.getElementById("navi"+j).style.backgroundPosition = "0 -12";                       
            document.getElementById("image_description"+j).style.visibility = "hidden";
        }
    } else { //Safari
            document.getElementById("navi"+j).style.backgroundPosition = "bottom bottom";                                   
            document.getElementById("image_description"+j).style.visibility = "hidden";     
    }

    if (j===count){

            if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
                var ieversion=new Number(RegExp.$1) 
                if (ieversion>=6){
                    document.getElementById("navi"+j).style.backgroundPosition = "0 0";         
                    document.getElementById("image_description"+j).style.visibility = "visible";
                }
            } else if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ 
                var ffversion=new Number(RegExp.$1)
                if (ffversion>=3){
                    document.getElementById("navi"+j).style.backgroundPosition = "0 0";                 
                    document.getElementById("image_description"+j).style.visibility = "visible";
                }
            } else { //Safari
                document.getElementById("navi"+j).style.backgroundPosition = "top top";         
                document.getElementById("image_description"+j).style.visibility = "visible";                
            }               
        }   
    }   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:51:20+00:00Added an answer on May 28, 2026 at 1:51 pm

    Have you tried with adding px unit ?

    Seems to be possible duplicate of :
    CSS/Javascript How do I make this background-position movie in Firefox like it does in IE7+?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code only seems to work in Firefox. Safari and Opera don't like it:
Firefox and seems to render a hyphen followed by &nbsp; differently to other browsers.
In Firefox a Reload seems to reload everything while on IE the Refresh reloads
It seems that HTML 5 is going to be supported (partially) by Firefox 3.1
When I try to start Firefox using Process.Start and ProcessStartInfo (.NET) everything seems to
Firefox 3.5 does not allow creating java OBJECT tag with Javascript (document.write)? this technique
The code below is for sliding a div inside another hidden overflow div (concept
I need to temporally allow cross domain XMLHttpRequest. Changing firefox security setting seems to
I have an issue that seems to be appearing in Firefox 3.5.2. When i
Its strange but when I add a form to my page, firefox seems to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.