JavaScript Tutorial/Dialogs/prompt
Get value from prompt dialog and display it on another dialog
<html>
<head>
<title>A Simple Page</title>
<script language="javascript">
<!--
yourname = prompt("What is your name?","Type your name here ...");
alert(yourname);
// -->
</script>
</head>
<body>
</body>
</html>
prompt Dialog
<html>
<head>
<script language="javascript" type = "text/javascript">
<!--
function verify_password()
{
var docpwrd = prompt("Specify the password for this document:", "");
if (docpwrd == "pwrdfile") {
self.location = docpwrd + ".htm";
} else {
alert("That is not the correct password.");
}
}
//-->
</script>
</head>
<body>
<form>
<input type="button" value="Open Password Protected File." name="OpenFile" onClick="verify_password()"></p>
</form>
</body>
</html>
Prompt dialog with default value
<html>
<head>
<title>A Simple Page</title>
<script language="javascript">
<!--
prompt("What is your name?","Enter your name here.")
// -->
</script>
</head>
<body>
</body>
</html>