You can assign the value from prompt to some hiddenfield and use it on the server side.
HTML Code
<script language="javascript" type="text/javascript">
function getPassword()
{
var pwd = prompt('Please enter your password:', '');
if(pwd != null)
{
if(pwd != '')
{
document.getElementById('hidPassword').value = pwd;
return true;
}
}
return false;
}
</script>
<asp:Button ID="Button2" runat="server" Text="Button2_Click" OnClientClick="return getPassword()" OnClick="Button2_Click1"/>
<asp:HiddenField ID="hidPassword" Value="" runat="server" />
Server side code
protected void Button2_Click1(object sender, EventArgs e)
{
Response.Write(hidPassword.Value);
}
There is no inbuilt masking capability for prompt in javascript. If you want to do anything like that, you need to create custom model popups.
There are lot of free code availble to create custom odel popups. Here are some sample links
http://javascript.about.com/library/blmodald1.htm
http://www.orangoo.com/labs/GreyBox/
http://jquery.com/demo/thickbox/
In thease popups you can show what ever html you want. So crate another HTML page with a password textbox, show it in the popup, get the value........