| Previous Topic | Tutorial Table of Contents | td align="center" width="2"13>Next Topic
Example scripts:
a href="fadein.html">Fade-in script
As this script loads, the document fades from black to white.
String trimmer
When checking input from users, you may need to make sure there
isn't any "white space" (spaces, tabs, returns) at the front or end of the input
value. This script will remove those before submitting the form.
Checking screen size and browser version
As a page loads you can check a number of features
about the user's environment, such as screen size, browser type, browser
version. With this information you can send a user to different versions
of your web page.
Temperature converter
JavaScript can be used to convert between Celsius
and Fahrenheit scales without requesting help from the server. In
addition, this script formats the output so that it rounds to two decimal
places.
Script that demonstrates the uses of arrays and the creation
of user-defined objects
You can create your own objects. This script
creates a set of objects of favorite books. The user is asked what
his or her favorite book is and if there is a match the script lets you
know. Secondly, a selection list and textarea area used to give the
reader more information about the listed books.
NewButtons Script
This script allows you to create buttons that emulate regular html-generated buttons
-- they "depress" when you press them and "unpress" when you release the mouse button.
One submit Only Script
Have you even been to a website that said in bright bold letters: "ONLY CLICK O
THE submit BUTTON ONCE PLEASE!!!!"? Well, there's an easier way to handle it
than shouting at the customer. It's called JavaScript. This script will catch all
attempts to make further submissions of a form after the first one -- and lets the user
know what happened after such an attempt.
Required Fields and Cursor Placement
When you have certain lines in fill-out forms that must be filled in before the
user submits the form, you can use JavaScript to check and make sure those
lines have been filled in. If not, you can cancel the submission, alert
the user and place the cursor in the field that needs to be filled out.
| Previous Topic | Tutorial Table of Contents | Next Topic |