Home  >  Article  >  Web Front-end  >  Solve the problem of clicking backspace to return to the previous page

Solve the problem of clicking backspace to return to the previous page

巴扎黑
巴扎黑Original
2016-11-25 11:03:301971browse

The code is as follows:
/**
*
* It is forbidden to click backspace to return to the previous page
*/
window.onload=function(){
document.getElementsByTagName("body")[0].onkeydown =function(){
                                                                                                                                                                                  The code ELEM = EVENT.RELELATEDTARGET || Event.srcelement || Event.target || Event.currenttarget; Time label Make the pointed element
            var elem = event.srcElement                                                                var name = elem.nodeName;
                                           && name!='TEXTAREA'){                                                                                                                                                                                                 If(name=='INPUT' && (type_e!='TEXT' && type_e! ='TEXTAREA' && type_e!='PASSWORD' && type_e!='FILE')){                                                                                                                                                                      NPUT' && (elem.readOnly==true || elem .disabled == True) {
Return_Stopit (Event);

if (



e.preventDefault ){
                                                                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn