Chapter 11. Dreamweaver Behaviors

Chapter 5 makes clear how easy it is to add mouse rollover effects using Dreamweaver’s Rollover Image object. That and other interactive features rely on scripts (small programs) written in the JavaScript programming language.

You could create the same effects without Dreamweaver, but you’d need to take a few extra steps: buy a book on JavaScript; read it from cover to cover; learn about concepts like arrays, functions, and document object models; and spend weeks discovering the eccentric rules governing how different browsers interpret JavaScript code differently.

With behaviors, however, Dreamweaver lets you add these dynamic JavaScript programs to your Web pages without doing a lick of programming.

Note

Unfortunately, Macromedia hasn’t added any new behaviors or improved the current crop since Dreamweaver MX. However, if you’re an intrepid programmer, you can use Dreamweaver Extensions (see Chapter 19) to whip up your own behaviors.

Understanding Behaviors

Dreamweaver behaviors are prepackaged JavaScript programs that let you add interactivity to your Web pages with ease, even if you don’t know the first thing about JavaScript. By adding behaviors, you can make your Web pages do things like:

  • Make layers appear and disappear.

  • Require visitors to fill out certain fields in a form (Chapter 10)—when, for example, you want to make sure that visitors enter an email address or name before submitting the form.

  • Open a new browser window to a specified size, ...

Get Dreamweaver 8: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.