I would like to prevent a person from pressing Alt+Home to replace the web page with their home page. This is the code:


function CancelAltHome()
return false;

var iKeyCode = window.event.keyCode;

if(iKeyCode == 36 && window.event.altKey)
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;


<body onkeydown="CancelAltHome()">
Test Cancelling Alt+Home

If I put an alert inside the "if" I can see that the keycode is correct, but the event does not get cancelled. However, I am able to cancel Ctrl+n (creates a new window) by doing:
if(iKeyCode == 78 && window.event.ctrlKey)

If that works, then what is wrong with the Alt+Home case??

Please note: I only care about IE 6

thank you!!