Entry
How can I capture the funktion keys (F1,F2....F5) on Netscape!?
May 16th, 2006 23:23
kris kris, bogo,
capture the onkeypress event and add some functionality to get the
keycode of events fired by FunctionKeys(F1-F12)..
evt.charCode will return 0 in Firefox, so you need to use
evt.keyCode, iam adding my sample code which disabling the F5 & CTRL+R
functionality in Firefox & Netscape.
the event codes start from (F1[112] to F12[123]}....
the numbers in Square brackets indicates the keycode of the function key.
if(browser == "Netscape")
{
document.onkeypress = function (evt)
{
var r = '';
if (document.getElementById)
{
r += evt.ctrlKey ? 'Ctrl-' : '';
r += evt.charCode;
if(evt.keyCode =="116" || r == "Ctrl-114") // event fired by NS when
F5(keycode:116) button is pressed.
{
evt.preventDefault();
evt.stopPropagation();
return false;
}
}
}
}
Hope this solves your problem..
thanks,
krishna