You'll use some Dreamweaver behaviors constantly. The basic rollover image, for
example, is so useful for navigation bars, you may end up putting it on every page
of your site.
Unfortunately, each time you add a behavior to a page, Dreamweaver adds lines of
library file, they don't have to waste time loading it again. Every page in your site that
uses, say, Dreamweaver's Swap Image behavior needs just a single line linking it to
can create your own for any Dreamweaver Behavior you use frequently. The following
Dreamweaver inserts for rollover images.
Create a new, blank Web page.
Since you're going to copy and paste chunks of code, you can see what you're doing
better if you start fresh with a new page.
Insert a rollover image.
(For a refresher on these steps, see Section 5.5.)
for the library file.
Scroll to the top of the page and look for the following code: <script
Select and copy all of the code between the script tags.
You should be copying four different functions (commands): MM_swapImgRestore,
MM_preloadImages, MM_findObj, and MM_swapImage. (Skip the HTML
Choose FileNew and click the General tab.
The New Document window appears with a list of possible document types.
Paste the Code you copied in step 5 into the document.
Save the file to your site.
you use, say, the Pop-Up Message behavior on most pages of your site as well, by
all means include code for that in the library, too.
to the page and梐s long as the behavior's code is in the file桪reamweaver doesn't
add any additional programming code to the page.
This tactic only works with Dreamweaver Behaviors. If you've used a third-party behavior (see Section 20.2), Dreamweaver adds that behaviors code to the page even if the exact code is in a linked external
it. Here's how:
Open a page you want to add the behavior to.
For example, open a page that will contain rollover images whose code is stored
Make sure you're in Design View (ViewDesign). Choose ViewHead Content.
Dreamweaver displays everything that appears in the <head> portion of the
Choose InsertHTMLScript ObjectsScript.
commands to a page.
You're not creating your own script right now, so you can close this window.
Click OK to close the Insert Script window.
Even though you didn't add any code, Dreamweaver did insert a <script> tag
In the Head portion of the document window, select the newly inserted script.
It looks like a small scroll, which should now appear highlighted. Now you can set
its properties in the Property inspector.
In the Property inspector, click the Link button (the small folder icon).
The Select Script window opens. Here you'll select a file, just like linking to a file,
graphic, or anything else in Dreamweaver.
Dreamweaver links the file to the page.
code, resulting in slimmer files and faster downloads.