[an error occurred while processing this directive]
javascript tutorial graphic


Webteacher Software now offers

The if-then statement.

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',"");
if(Ret=="castle") {
location = 'ch03_1.htm';
}
else {
alert("Please try again")
}

}

// - End of JavaScript - -->
</SCRIPT>

</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

Home | WebData - Web Database Software | Javascript | CGI | Consulting | Map Builder | Contact Us | The Press Room