Entry
Is there a way to prompt a user for a password (with a dialog like prompt not an input type="password")?
Dec 4th, 2002 19:15
Ryan Buterbaugh, Martin Honnen, http://httpd.apache.org/
No, there isn't.
window.prompt
has no different modes and there is no other dialog function providing
a hidden input.
All you could do is open a modal dialog window with an input
type=password field which is easy in IE4+:
--------------------- password.html --------------------------
<HTML>
<HEAD>
<SCRIPT>
</SCRIPT>
</HEAD>
<BODY>
<TABLE WIDTH="100%" HEIGHT="100%">
<TR>
<TD ALIGN="center" VALIGN="middle">
<FORM NAME="gui">
Enter password
<BR>
<INPUT TYPE="password" NAME="password">
<BR>
<INPUT TYPE="button" VALUE=" OK "
ONCLICK="window.returnValue = document.gui.password.value;
window.close();"
>
</FORM>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
----------------------------------------------------------------
var password = showModalDialog('password.html', null,
'dialogWidth: 200px; dialogHeight: 200px;')
================================================================
I think what you are looking for doesn't have anything to do
with Javascript at all. You may mean those domain boxes
that pop up and ask for your username and password. That is
accomplished with htaccess (in Apache). See http://httpd.apache.org/