|Language:||English, Spanish, Arabic|
|Genre:||Children & Youth|
|Distribution:||Free* [*Registration needed]|
Reading a Frames Dimensions 7. Resizing Frames 7. Setting Frameset Specifications Dynamically 8. Dynamic Forms 8. Auto-Focusing the First Text Field 8.
Performing Common Text Field Validations 8. Preventing Form Submission upon Validation Failure 8.
Using a Custom Validation Object 8. Changing a Forms Action 8. Blocking Submissions from the Enter Key 8. Disabling Form Controls 8. Hiding and Showing Form Controls 8. Changing select Element Content 8. Copying Form Data Between Pages 9. Managing Events 9. Initiating a Process After the Page Loads 9. Appending Multiple Load Event Handlers 9. Determining the Coordinates of a Click Event 9.
Blocking Duplicate Clicks 9. Determining Which Element Received an Event 9.
Synchronizing Sounds to Events Page Navigation Techniques Loading a New Page or Anchor Keeping a Page Out of the Browser History Using a select Element for Navigation Passing Data Between Pages via Cookies Passing Data Between Pages via Frames Creating a Contextual Right-Click Menu Creating Drop-Down Navigation Menus Providing Navigation Trail Menus Creating Expandable Menus Managing Style Sheets Importing External Style Sheets Toggling Between Style Sheets for an Element Page Navigation Techniques.
Managing Style Sheets. Visual Effects for Stationary Content. Creating Dynamic Content.
But we learned to live with it, as a long period of stability in one platform— Internet Explorer 6, in particular—meant that we could use our well-worn compatibility workarounds without cause for concern. The first is the wide proliferation of broadband connections.
At dial-up speeds, piling a 50—75 kilobyte script onto a page could seriously degrade perceived performance; at broadband speeds, nobody notices the difference. But without a doubt, the major attraction these days is the now widespread availability in all mainstream browsers of a technology first implemented by Microsoft: the XMLHttpRequest object. It is far more efficient than downloading a bunch of data with the page and less visually disruptive than the old submit-and-wait-for-a-new-page process.
In truth, Ajax is simply a catchy handle for an existing technology. Perhaps the most popular first implementation was Google Maps, whereby you could drag your way around a map, while scripts and the XMLHttpRequest object in the background downloaded adjacent blocks of the map in anticipation of your dragging your way over there.
At the same time, however, many recipes from the first edition have been revised with scripting practices that will serve both the beginner and the more advanced scripter well. Examples prepare you for the eventuality that your scripting skills will grow, perhaps leading to a mega DHTML app in the future.
No book could hope to anticipate every possible question from someone wishing to use these technologies in his web pages. You know how to put scripts into a web page—where tags go, as well as how to link an external.
This book is not a tutorial, but you can learn a lot from reading the introductions to each chapter and the discussions following each solution. You can use these recipes as they are or modify them to fit your designs. Of course, if you wish to acknowledge this book in your source code comments, that would be great!
The horror stories of yore about browser incompatibilities have kept your focus entirely on server-side programming. But now that so many mainstream sites are using client-side scripting to improve the user experience, you are ready to take another look at what is out there. For instance, you may have developed exclusively for the Internet Explorer browser on the Windows platform, but you wish to gravitate toward standards-compatible syntax for future coding.
Virtually every reader will find that some recipes in this book are too simple and others are too complex for their experience level. I hope the more difficult ones challenge you to learn more and improve your skills. Even if you think you know it all, be sure to check the discussions of the easier recipes for tips and insights that may be new to you.
To carry the cookbook metaphor too far, just as a culinary chef has identifiable procedures and seasonings, so do I format my code in a particular way and employ programming styles that I have adopted and updated over the years. More important than scripting style, however, are the implementation threads that weave their way throughout the code examples. Because these examples may serve as models for your own development, they are written for maximum clarity to make it easy I hope for you to follow the execution logic.
Names assigned to variables, functions, objects, and the like are meant to convey their purpose within the context of the example. You can use this format to reference element objects in browsers starting with Microsoft Internet Explorer 5 and the other mainstream browsers addressed in this edition Mozilla-based browsers, Safari, and Opera 7 or later , which means that the vast majority of browsers in use today support this standard. Where IE including About the Recipes xv IE 7 does not support the standard as in handling events , all recipes here include efficient cross-browser implementations.
The long period of browser stability we have enjoyed since the first edition means that visitors to public sites almost never use what are now antique browsers—IE prior to 5. All recipes are optimized for the current browsers, but they also try to prevent hassles for anyone driving by in her steam-powered browser. One credo dominates the recipes throughout this book: scripting must add value to static content on the page.
The examples here, while perhaps conservative, are intended to solve real-world problems that scripters and developers face in professional-quality applications. The scripting techniques and syntax you see throughout this book are designed for maximum forward compatibility.
With a bit of code added here and there to degrade gracefully in older browsers, your applications should be running fine well into the future. In Chapter 1, Strings, you will see the difference between a string value and a string object.