View Full Version : why this works in explorer not firefox

05-24-2006, 09:26 PM
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);
self.status="modifiers="+e.modifiers+" ("+mString+")"
else {
+ "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")

05-24-2006, 10:14 PM
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.

05-24-2006, 10:28 PM
if (parseInt(navigator.appVersion)>3) {
document.onmousedown = mouseDown;
if (navigator.appName=="Netscape")
This may work in Navigator 4, but all the
modern mozillas(since about 1998) use the DOM event model-

05-24-2006, 10:53 PM
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.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum