JavaScript
Quiz:
The
pages below need some work - you need to make the changes and get them to work.
Question
#1: This page uses a function and passes it a
color. Code the function and make the
page work.
<HTML>
<HEAD>
<TITLE>Changing
Color</TITLE>
</HEAD>
<BODY>
<FORM>
<INPUT
TYPE="button" NAME=redButton VALUE=RED
onClick="newColor('red')">
<INPUT
TYPE="button" NAME=orangeButton VALUE=ORANGE
onClick="newColor('orange')">
<INPUT
TYPE="button" NAME=yellowButton VALUE=YELLOW
onClick="newColor('yellow')">
<INPUT
TYPE="button" NAME=greenButton VALUE=GREEN
onClick="newColor('green')">
<INPUT
TYPE="button" NAME=blueButton VALUE=BLUE
onClick="newColor('blue')">
<INPUT
TYPE="button" NAME=purpleButton VALUE=PURPLE
onClick="newColor('purple')">
</FORM>
</BODY>
</HTML>
Question
#2: This
code takes in a password and then checks before opening a page.
<HTML>
<HEAD>
<TITLE>Password</TITLE>
</HEAD>
<BODY>
<H1>Password
test!</H1>
<SCRIPT language="JavaScript">
var correctPassword;
var
thePassword="student";
correctPassword=prompt("Please
enter your password to view this page!","");
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.
</SCRIPT>
</BODY>
</HTML>