I'm writing a minesweeper clone in javascript and since most browsers won't let you capture right clicks I need some other way to flag a tile.
One way I am considering is control click. I found this code on the web and it seems to work for Internet Explorer
but as you can see from my implementation atCode:... if (parseInt(navigator.appVersion) > 3) { document.onmousedown = mouseDown; if (navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN); } ... /* this only works for IE at the moment */ function mouseDown(e) { if (parseInt(navigator.appVersion)>3) { if (navigator.appName == "Netscape") { var mString = (e.modifiers+32).toString(2).substring(3,6); shiftPressed = (mString.charAt(0)=="1"); ctrlPressed = (mString.charAt(1)=="1"); altPressed = (mString.charAt(2)=="1"); } else { shiftPressed= event.shiftKey; altPressed = event.altKey; ctrlPressed = event.ctrlKey; } } return true; }
http://users.cs.cf.ac.uk/B.A.Collins
it just doesn't work in any browser other than IE.
Are there any other ways of capturing a control-click that aren't about 30 years old? Also I probably should've posted this in tech.



LinkBack URL
About LinkBacks


