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>