|
Having fun with JavaScript |
What is JavaScript? Click here to find out.
Each of the examples below utilizes features of JavaScript. To view each example separately, click on the example reference link at the left side. To view the HTML and JavaScript programming instructions (also called the code) utilized in the example, click on the "view source" link shown within each example.
Does learning JavaScript seem too daunting a quest? The good news is that with a sophisticated Web page editor like Dreamweaver, you can build most of these examples without having to know any JavaScript. How is that possible? To find out, let's start by taking a look at Example 1.
| Example 1 Click on the names below to display text in "message boxes". | (Example 1 Alternate) |
| Jefferson Lincoln Roosevelt Kennedy Nixon Reagan |
|
|
(This text will be replaced when you pass the mouse pointer over a president's name.)
I would rather be exposed to the inconveniences attending too much liberty than to those attending too small a degree of it.
If I were two-faced, would I be wearing this one?
We have nothing to fear, but fear itself.
Ask not what your country can do for you, but what you can do for your country.
I am not a crook!
Trust but verify.
|
Blue Star Gold Star Green Star Purple Star Silver Star Yellow Star |
|
Example 3 Alternate #1 |
Example 4 Swap one image for
another
|
Swap one image for another
|
|
Change this blue star to a gold star. |
|
Client-side image maps store the hyperlink information in the HTML document, not in a separate map file as do server-side image maps. When the user clicks a hotspot in the image, the associated URL is sent directly to the server. This makes client-side image maps faster than server-side image maps, because the server does not need to interpret where the user clicked. Client-side image maps are supported by Netscape Navigator 2.0 and later, NCSA Mosaic 2.1 and 3.0, and all versions of Microsoft Internet Explorer. |
Example 6 Cycle through a series of images using an array and a time delay. |
|
or by clicking on something.| Example 9 Validate data and provide immediate feedback. | (Example 9 Alternate) |
|
| Example 12 Click on the text below to display graphics in a new window. |
|
Blue Star Gold Star Green Star Purple Star Silver Star Yellow Star |
| Example 13 Simple password access to protected web pages. | (Example 13 Alternate) |
For those who would like to look at a few JavaScript resources, L. Carlson, a UMD ITSS staff member, has started a JavaScript section in the Web Design Reference Site. http://www.d.umn.edu/itss/support/Training/Online/webdesign/ It includes information on JavaScript tutorials, comprehensive sites, articles, scripts, and the recommended book list provided in the "What is JavaScript?" document linked above.