Click to See Complete Forum and Search --> : How to catch ctrl+N


rabol
01-17-2004, 02:25 PM
Hi

I think that this question have been asked several times before, but I can't find the result.

How can I catch the ctrl+n combination?

Thanks in advance.

Steen

rabol
01-17-2004, 02:37 PM
Hi

Sorry... just 5 min after my post I found the solution

<script language="javascript">
function myKeybordHandler()
{
if(event.ctrlKey == true)
{
if(event.keyCode ==78)
{
alert("I did it!!");
event.cancelBubble = true;
event.returnValue = true;
}
}
}
</script>

and then inside the <body>
<script language="javascript">
document.onkeypress =myKeybordHandler;
document.onkeydown =myKeybordHandler;
</script>

Best
Steen