what is wrong this code???? JAVASCRIPT when I open it in my browser, the input box does not come up
what is wrong this code???? JAVASCRIPT when I open it in my browser, the input box does not come up
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Class HW </title>
<style type="text/css">
body p {
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align: center;
color: #2E0BF1;
font-size: 16px;
}
body p {
}
body {
background-color: #888888;
}
</style>
</head>
<body>
<h1 style="font-family: Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif; text-align: center;"> Introduction to JavaScript </h1>
<p> Homework #4 Part V.<strong> | </strong>Jen Sawvelle</p>
<p><img src="../runpic.jpg" width="400" height="200" alt=""/></p>
<script language="JavaScript" type="text/JavaScript">
var Name = "Who";
var Laps = 5;
/*Values of theses variables will be stored in the program. */
while (Laps > 0) //Finite loop using while stmnt
{
Name = prompt("Type the name of the runner: ");
Laps = prompt("Type number of laps to run: ");
document.write("I (" + Name + "),am going to run " + Laps + " laps! <br>");
if ((Laps >=1) && (Laps <= 10))
{
// Action statements to run around the track Laps times
for (lapCount = 1; lapCount <= Laps; lapCount++)
{
document.write(“Running lap “ + lapCount + “<br>”);
} // end of for loop
document.write(“I am a winner! <br>”); // Happy runner
}
else if (Laps != 0) // case for Laps greater than 10 or negative
{ // Action for false: Display to user to type a lap count between 1 and 10
document.write(“Invalid laps to run. <br>”);
document.write(“Type a number between 1 and 10 inclusive. <br>”);
}
else
{ // Laps is zero case.
// While loop will terminate and program will stop.
document.write(“Lap count is zero. Program will stop. <br>”);
} // end of if statement
document.write(“We did it! We did it!! <br>”); // group rejoice
}//end of for loop.
} //end of while loop.
</script>
</body>
</html>
Trending now
This is a popular solution!
Step by step
Solved in 2 steps