Tuesday, May 18, 2010

JavaScript to disable F5 button

<script language="javascript" >
function checkKeyCode(evt)
{

var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if(event.keyCode==116)
{
alert("F5 has been Disabled");
evt.keyCode=0;
return false
}
}
document.onkeydown=checkKeyCode;
</script >

1 comment:

  1. Great! It works fine in Chrome,IE,Safari but fails in Firefox.

    ReplyDelete