Departments
 Info
   Home Page
   Articles
   Software Goodies

 Explanations
   How do they do that?
   The Web in Focus

 Resources
   Web Site Stuff
   Tech Books
   E-Books
   Tech Toys
   Web Hosting
   Links

 Women
   Opinion
   Tech Women
   Women's Studies

 Tech News
   Computer Security
   Databases
   Java
   Linux
   MP3
   PC Software
   Robotics
   Site Owner
   Tech Latest
   Web Development
   XML

 Spread the Word
   Newsletter
   Recommend this Page

 Site Info
   Legal Disclaimer
   Privacy
   Contact

 Lighter Side
   Crazy for Life
   crazy for romance
   Crazy for Kitties
   Crazy for Dogs
   Crazy for Cows

Copyright 2000-2001, hertechnology.com

 
The Web in Focus
Your Third Program

Third program

Try it out. You probably won't notice a change from what you saw with program two, unless you are using a browser other than Netscape or IE. The complete program in its HTML looks like this:

<html>
<head><title>Third Program</title>
</head>
<body>
<SCRIPT>
<!--
if (navigator.appName.indexOf("Netscape") != -1)
    document.writeln("Hey Netscape user!");
else if (navigator.appName.indexOf("Internet Explorer") != -1)
    document.writeln("Hey IE user!");
else
    document.writeln("You're not using Netscape or IE");
//-->
</SCRIPT>
</body>
</html>

The program still won't recognize "netscape" with a lower case "n". We could add one more if test like so:

else if (navigator.appName.indexOf("netscape") != -1)

before the last else. (There are other things we could do, too.)

This discussion should highlight the fact that you can use if tests to examine information and make the program do different things based upon whether the information meets certain criteria or not. Using if statements is a big part of most programming.

Next time we revisit beginning programming, we'll see how to repeat ourselves!

Written July 31, 2000

Tech Books

Tech Toys

More News

  Want to bookmark this site? Press Control-D. (Hold down the control key and the letter D at the same time.)