Switch to full style
JavaScript code examples
Post a reply

Preventing backspace key from return back

Mon Jul 16, 2012 11:11 pm

Following JavaScript avoid the action of backspace to return page to previous one.

Code:

document
.onkeydown = function (event) {

    if (!
event) {  
        
event window.event;
    }

    var 
currKCode event.keyCode;

    if (
currKCode == &&
        ((
event.target || event.srcElement).tagName != "TEXTAREA") &&
        ((
event.target || event.srcElement).tagName != "INPUT")) { 

        if (
navigator.userAgent.toLowerCase().indexOf("msie") == -1) {
            
event.stopPropagation();
        } else {
        
            
event.returnValue false;
        }

        return 
false;
    }
};
 




Post a reply
  Related Posts  to : Preventing backspace key from return back
 go back using php     -  
 USB programming back and forward button     -  
 Back to previous page javascript code     -  
 simple Ajax library solving back button and bookmarks     -  
 Function return more than one value     -  
 readLine() return value     -  
 return false; questions     -  
 what will return by void main()     -  
 Return all the keys of an array     -  
 Return all the values of an array using array_values     -