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

    why this works in explorer not firefox

    im at a lost here. tried what i could but nothing.

    if this is simple could someone point me to what im doing wrong.

    the following code works under windows explorer but not mozilla firefox.

    yes its for school no they wont mind (they use explorer)
    yes id preffer if it worked in both


    <script language="JavaScript">
    <!--
    function mouseDown(e) {
    var shiftPressed=0;
    if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
    var mString =(e.modifiers+32).toString(2).substring(3,6);
    shiftPressed=(mString.charAt(0)=="1");
    self.status="modifiers="+e.modifiers+" ("+mString+")"
    }
    else {
    shiftPressed=event.shiftKey;
    self.status=""
    + "shiftKey="+event.shiftKey
    }
    if (shiftPressed)
    alert ("Mouse clicked with the following keys:\n"
    + (shiftPressed ? "Shift ":"")
    )
    }
    return true;
    }
    if (parseInt(navigator.appVersion)>3) {
    document.onmousedown = mouseDown;
    if (navigator.appName=="Netscape")
    document.captureEvents(Event.MOUSEDOWN);
    }
    //-->
    </script>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Tell us what its supposed to do. From the looks of its supposed to detect when the shift key is pressed. Some of the code you are using really shouldn't be used anymore because browsers can spoof their user agents. Object detect is a better method for detecting on whether not a browser can handle something.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    728
    Thanks
    35
    Thanked 132 Times in 123 Posts
    if (parseInt(navigator.appVersion)>3) {
    document.onmousedown = mouseDown;
    if (navigator.appName=="Netscape")
    document.captureEvents(Event.MOUSEDOWN);
    }
    This may work in Navigator 4, but all the
    modern mozillas(since about 1998) use the DOM event model-

  • #4
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanks for the help

    aerospace
    yes this program is to show a alert box when a user holds down shift and clicks
    on the mouse.

    i have it working in other browser except firefox

    but from what mrhoo says

    i would have to use DOM event model.

    so i have decided to skip it. and leave it the way it is.

    wasnt super important just wanted to make it available to all browsers.

    thanks again to you both for the quick response.


  •  

    Posting Permissions

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