16.5 Calling a Behavior from a Link

As seen earlier, you can use an event associated with an object to execute a behavior. You can also call the function directly from a hyperlink using the javascript: protocol followed by the name of the function to execute and its associated parameters. An example of this technique is shown in Figure 16-9.

Figure 16-9. Calling JavaScript directly via a hyperlink

Note that the link field in Figure 16-9 (which corresponds to the href attribute) contains:


This statement instructs the browser to execute the MM_goToURL function using the supplied parameters. The effect is similar to triggering the Go To URL behavior with the onClick event.

An alternative technique for attaching a behavior to a text span is discussed under "About behaviors and text" under Help figs/u2192.gif Using Dreamweaver.

The next chapter covers timelines and behaviors associated with them.

Dreamweaver in a Nutshell
Dreamweaver in a Nutshell
Year: 2005
Pages: 208

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net