[an error occurred while processing this directive]
OK, once again, here is the entire code. Give it a look, then we'll break it down. This is a good example of an If-Then statement. Password scripts can also be combined with an encryption function so that hackers can't break in simply by viewing your source code. The purpose of this chapter, however, is to give you some practice with if-then statements.
<HTML>
<HEAD>
<TITLE>Chapter 3, If-then statements</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript -
function password() {
Ret = prompt('Type the word castle',"");} // - End of JavaScript - -->
if(Ret=="castle") {
location = 'ch03_1.htm';} else {
alert("Please try again")}
</HEAD>
<BODY>
<A HREF="javascript:password()">
<IMG SRC="pict1.gif" NAME="pic1" ALT="about us!" BORDER="0" align="left"></A>
<H3>Click the image to enter a password protected document. Try a wrong entry first.</H3>
</BODY>
</HTML>
Break this puppy down |