Popup Windows
There are three different popup windows. Alert, Confirm, and Prompt. Alert is used for letting the user know something. Confirm is used when you want to ask the user a yes or no question. The user will be able to click either 'OK' or 'Cancel', OK will return 'true', and Cancel will return 'false'. The last, Prompt, will let the user fill in a small text field and then click OK to send the value of the text field to the script.
<html>
<head>
<title></title>
</head>
<script language="javascript">
function myPopup(){
alert("Welcome to my page!")
}
</script>
<body onload="myPopup()">
etc...
<html>
<head>
<title></title>
</head>
<script language="javascript">
function myPopup(){
confirm("Do you wish to enter the page?")
}
</script>
<body onload="myPopup()">
etc...
<html>
<head>
<title></title>
</head>
<script language="javascript">
function myPopup(){
prompt("Please enter your name:")
}
</script>
<body onload="myPopup()">
etc...
Notes:
- To ensure the code is copied correctly, please click here
