Lou0101
September 28th, 2009, 05:06 PM
Hello,
When this code is loaded on a webpage, no prompt pops up. Why is this simple code not working?
<html>
<head>
<title>Story</title>
</head>
<body>
<h1 style="text-align:center"><span style="color:black"> Story for CPSC 125 </span></h1>
<script type="text/javascript">
Name = prompt("Enter your first name:");
University = prompt("Enter a name of a University:");
Study = prompt("Enter an area of study (Computer Science, French, etc...):");
Dangerous = prompt("Enter a dangerous activity:")
lunch = prompt("Enter a lunch item:");
document.write("<p>... " + Name + " was a student at " + University + " who studied " + Study + "</p>");
document.write("<p> + Name + " was not very good at writing stories, but " + Name + " had a unique taste for " + Dangerous + ");
document.write("After a long day of " + Dangerous + " "," " + Name + " made a " + lunch + "</p>);
</script>
</body>
</html>
When this code is loaded on a webpage, no prompt pops up. Why is this simple code not working?
<html>
<head>
<title>Story</title>
</head>
<body>
<h1 style="text-align:center"><span style="color:black"> Story for CPSC 125 </span></h1>
<script type="text/javascript">
Name = prompt("Enter your first name:");
University = prompt("Enter a name of a University:");
Study = prompt("Enter an area of study (Computer Science, French, etc...):");
Dangerous = prompt("Enter a dangerous activity:")
lunch = prompt("Enter a lunch item:");
document.write("<p>... " + Name + " was a student at " + University + " who studied " + Study + "</p>");
document.write("<p> + Name + " was not very good at writing stories, but " + Name + " had a unique taste for " + Dangerous + ");
document.write("After a long day of " + Dangerous + " "," " + Name + " made a " + lunch + "</p>);
</script>
</body>
</html>