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:
javascript:MM_goToURL('parent','testing.html');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 → Using Dreamweaver.
The next chapter covers timelines and behaviors associated with them.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access