The Definition of a Condition
|
|
Conditions compare two values to see if they are the same. On the condition that they are the same, a certain amount of code runs that normally wouldn't have.
|
|
A day-to-day life example of a condition would be a traffic light; When the traffic light is red you don't cross, when the traffic light is green you do... This scenario does not seem to apply in California, so I will give another one for all of you "Callies" out there.
|
|
Another condition would be if you get in a wreck, then your car insurance inevitably goes up.
|
|
Here is a small script I've written for the sole purpose of demonstrating how to use conditions:
|
|
|
|
Still with me?... I didn't think so.
|
|
If, however, you are still with me, I'd like to show you some of the many semi-useful purposes of the if condition.
|
Half-baked password logins(don't expect this to keep out anyone but the really lazy or ignorant).
|
To test whether someone wants to continue on.
|
Another valued use for conditions is to clear you of any legal stuff that would really hurt you later on.
|
|
In the fifth chapter you'll be using DHTML; this allows you to create ways to interact with the person at your web page
|
|