|Language:||English, Spanish, French|
|Genre:||Academic & Education|
|Distribution:||Free* [*Registration Required]|
Testing on Multiple Browser Versions 6. Managing Browser Windows 6.
Living with Browser Window Control Limitations 6. Setting the Main Windows Size 6. Positioning the Main Window 6. Maximizing the Main Window 6. Creating a New Window 6.
Bringing a Window to the Front 6. Communicating with a New Window 6. Communicating Back to the Main Window 6. Simulating a Window with Layers 7. Managing Multiple Frames 7. Creating a Blank Frame in a New Frameset 7. Changing the Content of One Frame from Another 7.
Changing the Content of Multiple Frames at Once 7. Replacing a Frameset with a Single Page 7. Avoiding Being Framed by Another Site 7. Ensuring a Page Loads in Its Frameset 7.
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.
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.
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. Regular expressions play a big role in string parsing for these recipes. You will also see a reusable library for reading and writing string data to cookies. Chapter 2, Numbers and Dates, includes recipes for handling number formatting and conversions, as well as date calculations that get used in later recipes.
Recipes in this chapter provide the keys to one- and multidimensional array creation, array sorting, object creation, hash table simulation, and exploration of the prototype inheritance powers of objects. You also see how creating custom objects for your libraries can reduce potential naming conflicts as projects grow.
Chapter 4, Variables, Functions, and Flow Control, includes a recipe for improving overall script performance. Chapter 5 through Chapter 8 provide solutions for problems that apply to almost all scriptable browsers. If multiple windows are your nemesis, then Chapter 6, Managing Browser Windows, provides plenty of ideas to handle communication between windows. A few recipes present suggestions for modal windows or facsimiles thereof. Intelligent forms—one of the driving forces behind the creation of client-side scripting—are the subject of Chapter 8, Dynamic Forms.
Updated to modern techniques, recipes include form validation with or without regular expressions and some cool but subtle techniques found on some of the most popular web sites on the Internet. Chapter 11, Managing Style Sheets, provides recipes for both basic and advanced style sheet techniques as they apply to dynamic content, including how to load a browser- or operating system-specific stylesheet into the page.