Home > Web Front-end > JS Tutorial > body text

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

巴扎黑
Release: 2016-11-25 11:03:30
Original
2031 people have browsed it

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 ){
                                                                   

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!