Introduction to JavaScript + CSS + DOM Magic

(edited for the web)

Ever since graphical web browsers were unleashed, the World Wide Web has evolved in leaps and bounds. But arguably, the last 2 to 3 years have been the most exciting and yet frustrating period of time to be a web designer.

Since the introduction of graphical web browsers , we could stick to programming in plain old HTML and tweaking our GIFs and JPEGs. Now, however, even pure designers must deal with a lot more. We are now presented with a bewildering array of possibilities and technologies. Recent advances in browser technology and increasing demands from web users and developers have made many "tried and true" authoring methods, if not obsolete, then on their way to becoming so. Indeed, it's a challenging time for web designers and developers alike.

The foundation of any good web page is well-formed HTML or XHTML markup. Making web pages come to life are Cascading Style Sheets (CSS) for visual presentation and JavaScript for dynamism, and the glue that ties everything together is the Document Object Model (DOM). These are the core client-side technologies (the things that work in the browser, rather than on the server) of the World Wide Web.

This book is filled with practical examples of ways to use these technologies on real web sites. We've placed a great emphasis on showing you exactly how CSS,the DOM and JavaScript are used together. If you've been confused and even intimidated by all of these technologies, hopefully this book will help to clear some of that confusion, and give you the confidence to enhance your web sites and your skills. My goal is to get you to regard CSS, JavaScript and the DOM as tools that enhance your creativity and range as a web designer.

Why do it Yourself?

With the availability of visual editors, such as Macromedia Dreamweaver and Adobe GoLive, for creating web sites, you may be wondering why you should bother to create your own scripts, not to mention your own HTML or XHTML markup. Visual editors are a wonderful tool, and can greatly speed up your creation process.

However, relying solely on cut and paste scripts and the like puts a creative barrier between you and your creation. When you must rely on a ready-made script to accomplish something, you are forced to use the method chosen by the author of the script. When you know how to create or at least modify a script on your own, you can adapt and change things to suit your needs.

When it comes to CSS, you must create a unique stylesheet for your particular site or page. You can't simply copy someone else's stylesheet without knowing the rules.

A solid knowledge of the rules and syntax of both CSS and JavaScript, and most importantly of the way they work together, is essential to fully master the art of web page creation. It will also help you to use the visual editors more effectively.

Who I Am

I'm not a professional full-time writer. I design and build web sites for a living, and am also hired by other companies to help them implement these web technologies on web sites or in web-based applications in a practical, workable way. My background is in print design, so I'm very aware of the need for visual feedback and control that is a characteristic of many designers. While I always keep an eye on emerging technologies, I'm also always aware of the pressures of deadlines and the demands of clients. I hope that my experiences and battle scars will help you in your every day efforts to turn out web sites that are visually pleasing and functional.

Who You Are

This book is written for the web designer and creative professional with a fairly good knowledge of HTML, design principles, and basic web site construction. Chances are you have already started looking into using CSS on your sites, and you may have hacked a few scripts that you've picked up here and there. This is not a book for total beginners, but it doesn't assume that you're a programming whiz either.

In keeping with the aim of the Magic series, this book takes a very visual and "hands-on" approach. If you've been daunted by the more detailed, yet non-visual approach of most books about CSS, JavaScript and the DOM, or if you have been confused about how they actually work together on "real" web pages, then this book is for you.

How To Use This Book

This book is divided into sections. The projects in each section can stand on their own, but they are also presented in a way so that the principles and methods introduced in one are built on in subsequent chapters. If you are unsure about any of the subjects covered, you'll get the most out of the book by making your way systematically through the chapters. Take your time working on the projects, and play around with them until you understand what's going on.

If you are more experienced, you can skip around in the book. For example, if you already know about the importance of correct, well-formed HTML markup, skip the HTML/XHTML section of Chapter 1; if you can do basic JavaScript rollovers and can control framesets and windows in your sleep, skip Part 2, Basic JavaScript. You can also use this book like a cookbook to pick up quick solutions to urgent problems.

What's in This Book

This book is broken down into the following parts:

Assumptions as I wrote this Book

The Tools You'll Need for This Book

To Top of Page