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
A few JavaScript Tips
You've nearly reached the end of your 24-hour JavaScript education. Before you start madly scripting on your latest project, here are a few final tips to keep in mind:
- First, avoid gratuitous use of JavaScript or its features. While you may get a kick out of watching your page's title wiggle back and forth as your script manipulates it using the DOM, does such a feature really add value to your page?
- Next, be careful that your scripting doesn't take away normal browser conveniences. As an example, while you can display friendly descriptions on the status line when the user hovers over your links, doing this on links to external sites eliminates the browser's display of the URL, which is a useful feature.
- Another common example is pages that create their own JavaScript window of a set size. While this is sophisticated, it takes away the normal functionality of the Back and Forward buttons, and often the Status line. Worse, these pages often look quite small and silly when I see them taking up a tiny portion of my large monitor.
- Be sure you really need it before using a brand-new JavaScript feature. While it may be flashy or even add value to your page, be aware that the latest features will be enjoyed by only those users who are using brand-new browsers, and new features often have unexpected bugs. If you do use new features, be sure to use browser checking to include them only when the latest browsers are in use.
- Finally, make sure your page scales down gracefully. Test it with older browsers, and with non-JavaScript browsers. While users with these browsers may not be able to see your newest cosmetic improvements, make sure they can at least navigate your page and read its text.
Workshop: Using Cookies | Next Section

Account Sign In
View your cart