Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   disable 'backspace' key in Javascript. (http://www.programmingforums.org/showthread.php?t=12258)

pushkarajthorat Dec 26th, 2006 4:14 AM

disable 'backspace' key in Javascript.
 
Hi,

I am working in javascript with (AJAX), i am maintaining states of page in a javascript vars and now i have to disable backspace form javascript.

Thanks in advance.

Arevos Dec 26th, 2006 6:01 AM

:

  1. window.onkeypress = function(event) { return event.keyCode != 8; }

This binds the onkeypress event to a function that returns false if the keyCode is equal to 8 (which is backspace). Returning false on an event usually (always?) makes the browser ignore any further consequences of the event.


All times are GMT -5. The time now is 10:17 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC