al*****@gmail.com wrote:
I am looking for a way in JavaScript in IE 7.0 only, to have it detect
the Backspace key on the keyboard.
So like,
<script>
if backSpaceKeyPressed {
do stuff....
}
</script>
I can't seem to get this to work. Can someone please help me?
msdn.microsoft.com/workshop/author/dhtml/reference/events/onkeypress.asp
msdn.microsoft.com/workshop/author/dhtml/reference/objects/body.asp
<body onkeypress="if (event.keyCode==8) { alert('you pressed
backspace'); return false; }" onload="self.focus()">
Three remarks:
- focus needs to be in browser page (that's why I added the
onLoad-event)
- 'return false' is to prevent 'Go to previous page' (history back)
- MSIE proprietary
Hope this helps,
--
Bart