if (document.layers)
document.captureEvents(Event.KEYDOWN);
document.onkeydown = function (evt) {
var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
if (keyCode == 13) {
return false;
//Your function here.
}
else
return true;
};
OR
function preventEnter(evt) {
var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
if (keyCode == 13)
return false;
else
return true;
};
Usage: onkeydown="return preventEnter(event);"
document.captureEvents(Event.KEYDOWN);
document.onkeydown = function (evt) {
var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
if (keyCode == 13) {
return false;
//Your function here.
}
else
return true;
};
OR
function preventEnter(evt) {
var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
if (keyCode == 13)
return false;
else
return true;
};
Usage: onkeydown="return preventEnter(event);"
No comments:
Post a Comment