求以下Javascript代码:弹出一个密码输入框,输入内容为密文

luxes 2001-10-17 02:55:53
...全文
810 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
luxes 2001-10-17
  • 打赏
  • 举报
回复
没有实现的办法吗
karma 2001-10-17
  • 打赏
  • 举报
回复
应该不行
playmud 2001-10-17
  • 打赏
  • 举报
回复
yes
luxes 2001-10-17
  • 打赏
  • 举报
回复
多谢,我刚才没有说清楚。我是要弹出一个对话框,里面有一个密文的密码框。能够使用
window.prompt实现吗?
karma 2001-10-17
  • 打赏
  • 举报
回复
1. password.html:
<html>
<head>
<title>Password</title>
<script language="javascript">
function CloseWin(bCheckPass)
{
if (bCheckPass)
{
if (document.pwdform.pwd.value == "")
{
alert("Please enter a valid password");
document.pwdform.pwd.focus();
return;
}
else
{
window.returnValue = document.pwdform.pwd.value;
}
}

window.close();
}
</script>
</head>
<body>
<form name="pwdform">
<table>
<tr>
<td>Please enter your password:</td>
<td><input type="password" name="pwd"></td>
</tr>
<tr>
<td align="right"><input type="button" value="OK" onclick="CloseWin(true)"></td>
<td><input type="button" value="Cancel" onclick="CloseWin(false)"></td>
</tr>
</table>
</form>
</body>
</html>

2. usepassword.html:
<script language="javascript">
var pwd = showModalDialog("password.html",null,"dialogHeight:100px;dialogWidth:400px;status:no;help:no;resizable:no; edge: raised; center: yes; ");
if (pwd)
alert(pwd);
</script>

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧