Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q1345

Feedback on: irt.org FAQ Knowledge Base Q1345

Sent by Abi on May 16, 2000 at 14:48:49: - feedback #1241

Worth:
Worth reading

Comments:
I tried this function but it still never worked. Actually I have this backspace key problem on the dropdown (select) box. Is there a way to cancel the key differently on this form element?


Sent by anonymous on May 30, 2000 at 02:14:12: - feedback #1301

Technical:
Not technical enough

Comments:
Works on IE5.0 and not on IE4.0


Sent by Gary LaRock on October 24, 2000 at 20:43:01: - feedback #1907

Worth:
Very worth reading

Length:
Just right

Technical:
Just right

Comments:
This trick didn't work for me, but this code seems to do the trick:

if(event && event.keyCode == 8)
event.keyCode = 0;


Sent by David Cheung on March 30, 2001 at 09:51:15: - feedback #2565

Technical:
Just right

Comments:
Gray's version works for both IE4 and IE5. But we need the backspace to work for text and textareas, the function should be modified to:

if (window.event && window.event.srcElement.tagName !='INPUT' &&
window.event.srcElement.tagName !='TEXTAREA' && window.event.keyCode == 8) {
//Cancel the backspace
window.event.keyCode = 0;
}



Sent by Naresh Thandu on Thursday May 17, 2007 at 07:16:15 - feedback #4587

Worth:

Length:

Technical:

Comments:
<script language="JavaScript"><!--
document.onkeydown = mykeyhandler;

function mykeyhandler() {
if (window.event && window.event.keyCode == 8) {
// try to cancel the backspace
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}
//--></script>

Here in the above script just check out for the event's source element's tag name.If cursor is not focussed in any text box you will find out the tag name 'body',other wise you will get 'input'.
It can be done in this way
function mykeyhandler() {
if (window.event && window.event.keyCode == 8 && window.event..srcElement.tagName == "BODY") {
// try to cancel the backspace
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}





©2018 Martin Webb