Sams Teach Yourself JavaScript in 24 Hours
- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- We Want to Hear from You!
- Reader Services
- Introduction
- Part I: Getting Started
- Hour 1. Understanding JavaScript
- Hour 2. Creating a Simple Script
- Hour 3. How JavaScript Programs Work
- Part II: Learning JavaScript Basics
- Hour 4. Using Functions and Variables
- Hour 5. Using Strings and Arrays
- Hour 6. Testing and Comparing Values
- Hour 7. Repeating Yourself: Using Loops
- Hour 8. Using Math and Date Functions
- Part III: The Document Object Model (DOM)
- Hour 9. Working with the Document Object Model
- Hour 10. Responding to Events
- Hour 11. Using Windows and Frames
- Hour 12. Getting Data with Forms
- Hour 13. Using Graphics and Animation
- Part IV: Moving on to Advanced JavaScript Features
- Hour 14. Creating Cross-Browser Scripts
- Hour 15. Creating Custom Objects
- Hour 16. Working with Sounds and Plug-Ins
- Hour 17. Debugging JavaScript Applications
- Part V: Working with Dynamic HTML (DHTML)
- Hour 18. Working with Style Sheets
- Hour 19. Using Dynamic HTML (DHTML)
- Hour 20. Using Advanced DOM Features
- Part VI: Putting It All Together
- Hour 21. Improving a Web Page with JavaScript
- Hour 22. Creating a JavaScript Game
- Hour 23. Creating DHTML Applications
- Hour 24. JavaScript Tips and Tricks
- Part VII: Appendices
- Appendix A. Other JavaScript Resources
- Appendix B. Tools for JavaScript Developers
- Appendix C. Glossary
- Appendix D. JavaScript Quick Reference
- Appendix E. DOM Quick Reference
Creating the HTML Document
For this example, you'll start with the Web page of a small (and hopeless) software company known as Fictional Software Company (FSC). Their Web page is rather unimpressive, but you've got to start somewhere.
The main FSC Web page is shown in Figure 21.1. It includes a logo at the top, three paragraphs of information, and a simple bulleted list of links to the various subpages. This page is defined using the HTML in Listing 21.1.
Figure 21.1 A simple Web page using only HTML.
Example 21.1. The HTML Document for the Initial FSC Web Page
<html> <head><title>Fictional Software Company</title></head> <body> <img SRC="fsclogo.gif" alt="Fictional Software Company"> <hr> <p>Welcome to our Web page! Fictional Software Company specializes in creating innovative, user-friendly software applications with descriptions filled with industry buzzwords.</p> <p>We have a wide range of products (3 of them) to meet the needs of you and your company. Follow the links below for more information. </p> <ul> <li><a HREF="spread.html">Fictional Spreadsheet 7.0</a> <li><a HREF="word.html">Fictional Word Processor 6.0</a> <li><a HREF="data.html">Fictional Database 7.0</a> </ul> <p> Unlike other software companies, our products have absolutely no bugs, and always work perfectly on all computers. Nevertheless, you may run into problems in rare cases, usually your own fault. If this happens, visit our <a HREF="support.html">Technical Support</a> department for helpful information and tips. You can also view more information <a HREF="company.html">about our company</a> or order products with our friendly <a href="order.html">Order Form</a>.</p> <hr> <p><i>(c)2002 FSC - designed by the FSC staff</i></p> </body> </html>
The various links on the page send you to the company's other pages. One describes all of the company's products, another contains information about the company, and another gives technical support information. There's also a link to an order form.
Using Drop-Down Lists for Navigation | Next Section

Account Sign In
View your cart