This project is a web based html and Javascript site. I am working on mac at the moment. This script works except for attempting to open new window once complete.
As you can see, i am new to javascript coding. Can i open a new browser window after my prompts and alerts have finished. I am not sure what i am doing wrong.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function displayMessage() {
alert("Hello " + ", thanks for being patient just a few more question before we procced!")
var ans = prompt("Do you have some time to answer some questions?");
if (ans == "no") {
return;// stop the script
}
else {
alert ("about to open window");
window.open("form2.html","test","toolbar=no,menuba r=no,width=200,height=200,resizable=yes"); // I want to a open new window after prompts are finished.
alert ("Your answers will be placed in the appropriate areas, please check form once complete");
alert ( "thank you, we shall proceed");
prompt("Your first name");
prompt("Your last name ");
prompt("Your street address");
prompt("Your apt number");
prompt("Your city");
}
}
</script>
</head>
<body onLoad ="javascript:displayMessage();">
i change this line every time i reopen the page to make sure i am opening the right page.
</body>
</html>