Hi,
I have an internal, IE only web app and I need to capture certain key combinations and cancel the events. Here is a sample page:
<html>
<head>
<title>Test Page</title>
</head>
<body>
<script language=”JavaScript”>
function KeyDown(){
exitValue = true;
//capture [alt]+[home]
if(event.keyCode == 36 && event.altKey) {
// alert(“got it”)
document.all[‘messageArea’].innerHTML = “Got it!”;
event.keyCode=0
event.returnValue=false
exitValue=false
}
return exitValue
}
document.onkeydown=KeyDown
</script>
<div id=”messageArea”>Loaded … </div>
</body>
</html>
If you look at the part where the alert is, you’ll see that it’s commented out. With it commented out, all of the code runs and then you still get sent to the home page (alt + home). However, when the alert is called, the code runs and you are NOT sent to the home page.
Finally, the question:
What is happening to the event when an alert is called? Is there another way to cancel the event without opening a new window or an alert box?
Thanks in advance!