Click to See Complete Forum and Search --> : onKeyDown -> disable browser actions


luc
02-13-2003, 07:50 AM
Hello,

Is it possible to disable or avoid the default browser action when pressing on a key, using the onKeyDown?

i.e. if I try this...

switch(window.event.keyCode)
{
case 114: // Functionkey F3
foo()
break;
}

If I press the F3-key, the function will be executed, but also the default action of my IE6.0 (search) will be triggered. Is it possible to avoid this?

K.R.

Luc

gil davis
02-13-2003, 08:09 AM
Looking at the documentation at http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onkeydown.asp it would appear that you cannot cancel the default action of any F key, unless you are an HTA.

pyro
02-13-2003, 08:11 AM
Originally posted by luc
If I press the F3-key, the function will be executed, but also the default action of my IE6.0 (search) will be triggered. Is it possible to avoid this?I don't think so. You are always better off choosing keys that don't have default values, if possible.