javascript input via native popup
In the past, I've seen javascript alert()
style popups but they had input fields in them.
These forms are much like the pr开发者_如何学Cimitive username/password field inputs you see when an .htpasswd
file is used.
Can someone tell me how to implement this using regular javascript? (No libraries please)
Yes, you're thinking of prompt
. It's just:
var userInput = prompt("text to display", "default input text");
Note that this is just a general input mechanism. It's separate from the authentication dialog, though the underlying browser code may use the same GUI controls.
精彩评论