disable backspace
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nanda_Kishore
Posted On:   Thursday, November 6, 2003 01:21 AM

how to disable backspace in IE all the time except when the focus is in a textfield or text area... the below function disables the backspace key but how do i know where the focus is ..! I need a generic solution rather than calling this onfocus() method of textbox or textarea coz i have a lot of jsp pages to implement this .... function mykeyhandler() { if (window.event && window.event.keyCode == 8) { // try to cancel thebackspace for (var i=0;i { var e= document.forms[0].elements[i]; if ((e.type=="text")&& (e.type=="textarea")) { alert(e.type.value); window.event.cancelBubble = true; window.event.returnValue = false; ret   More>>

how to disable backspace in IE all the time except when the focus is in a textfield or text area...
the below function disables the backspace key but how do i know where the focus is ..! I need a generic solution rather than calling this onfocus() method of textbox or textarea coz i have a lot of jsp pages to implement this ....


function mykeyhandler() {
if (window.event && window.event.keyCode == 8) { // try to cancel thebackspace
for (var i=0;i
{
var e= document.forms[0].elements[i];


if ((e.type=="text")&& (e.type=="textarea"))
{ alert(e.type.value);
window.event.cancelBubble = true;
window.event.returnValue = false;
return true;
}
else{
window.event.cancelBubble = false;
window.event.returnValue = true;
return false;
}
}
}
}


document.onkeydown = mykeyhandler;

   <<Less
About | Sitemap | Contact