Java Script Quiz #3:

Question #1: Follow the directions in the code.  Note there is an extra credit component.

<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>Password question</title>

</head>

<body>

<h1>Password test!</h1>

<script type="text/javascript">

<!--

var correctPassword;

var thePassword="student";

correctPassword=prompt("Please enter password to view this page!","");

//You need to insert a IF statement here to check to see if the //password is correct.  If it is not correct you want to put out an //alert.  If it is correct then you want to go to a

//window.location that is my home page.

//To get extra credit: you should loop and give the user three chances //to get the password correct.  If they get it you should go to my //page, if they do not you should tell them access is denied.  Each //time they try and get it wrong, you should put out a message on the //form or an alert

//-->

</script>

</body>

</html>

Question #2:  Use one of the avgfunc examples (be sure to tell me which one).  Modify it so that you take in on hand, on order and the reorder point for an inventory.  Calculate the number to order by subtracting the sum of on hand and on order from reorder point.  If the number to order is greater than 0, write the number that needs to be ordered, if not write a message saying no order needed.

Question #3:  Fix the math facts program (you can use mathfor1x.html, mathfor2x.html or mathfor2ax.html) so that if the student gives a wrong answer, a while loop will stay at that problem giving an incorrect message until the user enters the correct answer.

Question #4: Find a JavaScript routine on the Web and modify it.  You need to show me the original, explain the modification and show me the modified version.