Readers of this book should be familiar with web page technology, including Cascading Style Sheets (CSS) and HTML/XHTML. Previous programming experience isn’t required, though some sections may require extra review if you have no previous exposure to programming.
This book should help:
Anyone who uses a content-management tool, such as a weblogging tool, and wants to better understand the scripting components incorporated into her tool templates
Web service developers who want to develop for a new market of clients
Teachers who use web technologies as either the focus or a component of their courses
Web page designers who wish to better understand how they can enliven their designs with interactive or animated effects
Anyone interested in web technologies
You can download Firefox from http://www.mozilla.com/en-US/firefox/.
Safari is installed with Mac OS X, but you can also access it for the Mac and Windows at http://www.apple.com/safari/. Safari is based on the open source WebKit project, which provides nightly builds for testing at http://webkit.org/.
You can access Opera at http://www.opera.com/.
Internet Explorer is built into Windows, but you can access the IE8 beta at http://www.microsoft.com/windows/internet-explorer/beta/default.aspx.
In addition, browser makers are always introducing new versions of their tools. The target browsers used to test examples in this book reflect the state of the browsers at the time I wrote the book, which may not quite reflect what you’ll find when you read the book.
Knock on wood.
The book is organized into six loosely grouped sections.
Boolean, in addition to other built-in objects,
RegExp (for regular
Array, and the
Chapter 6 takes a breather from the language bits and prepares the reader for the more complex scripting examples later in the book by introducing the browser debugging tools, as well as troubleshooting techniques.
Chapters 9 through 11 delve into the more sophisticated aspects of web page development. These chapters cover the Browser Object Model (BOM) and the newer Document Object Model (DOM), and show how you can create your own custom objects. Understanding these models is essential if you wish to create new windows, or individually access, modify, or even dynamically create any page element. In addition, with custom objects, you can move beyond the capabilities that are pre-built into either language or browser. Also included in these chapters is a look at browser cookies and some of the more modern client-side storage techniques.
The following is a detailed breakdown of this book’s contents, including a brief description of what each chapter covers:
Boolean, as well as
Math. The chapter also introduces the
RegExp object, which provides
the facilities to do pattern matching.
Function is key to creating custom
functionality that can be invoked more than once in an
Briefly introduces the debugging environments for the book’s target browsers (Internet Explorer, Safari, Firefox, and Opera), as well as covers basic cross-browser development.
Focuses on event handling, including both the original form of event handling (which is still commonly used in many applications) as well as the newer DOM-based event handling.
Focuses on the DOM, a straightforward, but not trivial, object model that provides access to all document elements and attributes. Though the model is comprehensive and its coverage is fairly straightforward, the chapter could present some challenging moments for new programmers.
Provides a general introduction to dynamically altering the web page, including modifying an individual element’s style, as well as adding and removing elements from the page. Some of the effects we’ll explore in this chapter include drag-and-drop, collapsing and expanding page sections, visibility, and movement. An understanding of CSS is required.
Expands on the example in Chapter 14 that demonstrated Ajax with an HTML fragment by demonstrating how to generate and process XML through an Ajax application, and then how to do the same with JSON. We’ll cover the advantages of both techniques, as well as when to use one over the other.
The following typographical conventions are used in this book:
Used for command lines and options that should be typed verbatim, C# keywords, and code examples
Constant width italic
Used for replaceable items, such as variables or optional elements, within syntax lines or code
Constant width bold
Used for emphasis within program code
Used for pathnames, filenames, Internet addresses (such as domain names and URLs), and new terms where they are defined
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.
If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at firstname.lastname@example.org.
When you see a Safari® Books Online icon on the cover of your favorite technology book, that means the book is available online through the O’Reilly Network Safari Bookshelf.
Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at http://safari.oreilly.com.
We have tested and verified the information in this book to the best of our ability, but you might find that features have changed (or even that we have made mistakes!). Please let us know about any errors you find, as well as your suggestions for future editions, by writing to:
|O’Reilly Media, Inc.|
|1005 Gravenstein Highway North|
|Sebastopol, CA 95472|
|800-998-9938 (in the United States or Canada)|
To ask technical questions or comment on the book, send email to:
We have a web page for this book where we list examples and any plans for future editions. You can access this information at:
For more information about books, conferences, Resource Centers, and the O’Reilly Network, see the O’Reilly website at:
I want to thank my editing and review team for helping me write a better book. This includes technical editors Tony Ruscoe, Jeni Tennison, Matthew Russell, and Trey Holdener, who did an excellent job reviewing the content, as well as my long-time editor, Simon St.Laurent. In addition, I’d like to thank the other members of the production team: Rachel Monaghan, Sumita Mukherji, Joe Wizda, and Jessamyn Read.