简体   繁体   中英

JavaScript prompt() won't work in AppJS

I'm making an app in AppJS, and the prompt() function wont work. I've looked it up, tried window.prompt() and many other things, but nothing has worked. I'm trying to see when the Esc key is pressed, then the person enters the password. If the password is correct, then the it will run window.close() . The prompt box does not popup.

window.addEventListener('keydown', function(e){
    if(e.keyCode == 27){
        var pw = prompt('Please enter the password.');
        if(pw == 'password') window.close();
    }
}, false);

AppJS has overridden the default window.prompt method.

Here is the Google groups discussion thread .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM