Removes functionality of F5 (refresh) on a an entire page. Useful with forms etc.
You can remove pretty much any keycode you so choose, but be careful. Users of a website aren't acustomed to having functionality changed/removed, so weigh the benefits with possible consequences.
//Yes. You did read right, no function.
if (document.all)
{
//for IE browser
document.onkeydown = function ()
{
if (event.keyCode == 116)
{
event.keyCode=0;
return false;
}
return event.keyCode;
}
}
else
{ //for FireFox/Netscape (others?)
document.onkeypress = function (evt)
{
if(evt.keyCode == 116)
{ return false; }
return evt.keyCode;
}
}