tags:

views:

19

answers:

1

In the past, I've seen javascript alert() style popups but they had input fields in them.

These forms are much like the primitive 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)

+4  A: 

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.

Matthew Flaschen
It doesn't ask for `user` and `password`.
BrunoLM
@Bruno, he said "very much like." I think the question is general, and he just means the appearance is similar.
Matthew Flaschen
@BrunoLMI didn't get the impression that the question was looking specifically for a username/password box, just a text input box.
meagar
This is exactly what I was looking for. Googling for "javascript input form" (or other related terms) wasn't much help.
macek