|
|
Overview
Using Dreamweaver, you can easily add a variety
of content to web pages. Add assets and design elements, such as
text, images, colors, movies, sound, and other forms of media. Using
the Asset panel allows you to easily organize the assets in a site;
you can then drag most assets directly from the Assets panel into
a Dreamweaver document. JavaScript behaviours may be applied to
various objects and events to allow users to interact with the web
pages of your site. |
Assets and Library Items
Assets
The Assets panel helps you manage and organize
your site's assets more easily than you can in the Site panel. Assets
are categorized and display in a list.
To view assets in a particular category, click
the appropriate icon. Dreamweaver displays the following categories
of assets:
- Images are image files in GIF, JPEG, or PNG formats. For information
about images, see Inserting Images.
- Colors are the colors that are used in documents and style sheets
in your site, including text colors, background colors, and link
colors.
- URLs are the external links in your current site documents.
This category includes the following types of links: FTP, gopher,
HTTP, HTTPS, JavaScript, e-mail (mailto), and local file (file://).
- Flash movies are files in any version of Macromedia Flash format.
The Assets panel displays only SWF files (compressed Flash files),
but not FLA (Flash source) files.
- Shockwave movies are files in any version of Macromedia Shockwave
format.
- Movies are files in QuickTime or MPEG format.
- Scripts are JavaScript or VBScript files. Note that scripts
in HTML files (rather than in independent JavaScript or VBScript
files) do not appear in the Assets panel. For information on working
with JavaScript in Macromedia Dreamweaver, see Using the JavaScript
debugger.
- Templates provide an easy way to reuse the same page layout
on multiple pages and to modify the layout on all pages attached
to a template when a template is modified. See About Dreamweaver
templates.
- Library items are elements that you use in multiple pages; when
you modify a library item, all pages that contain that item are
updated. See Working with Library items.
Note: Only files that fit into these categories
show in the Assets panel. There are other types of files that are
sometimes called assets, but they aren't shown in the panel.
Viewing assets in the Assets panel
The Assets panel provides two ways to view assets:
the Site list, which shows all of the assets in your site, and the
Favorites list, which shows only the assets you've explicitly chosen.
|
|
Library Items
You can create a library item from any element
in the body section of a document, including text, tables, forms,
Java applets, plug-ins, ActiveX elements, navigation bars, and images.
For linked items such as images, the library stores
only a reference to the item. The original file must remain at the
specified location for the library item to work correctly. It can
still be useful to store an image in a library item, though; for
example, you could store a complete img tag in a library item, which
would allow you to easily change the image's alt text, or even its
src attribute, throughout the site. (Don't use this technique to
change an image's width and height attributes, though, unless you
also use an image editor to change the actual size of the image.)
|
To create a library item:
- Select a portion of a document to save as a library item.
- Do one of the following:
- Choose Window > Library and drag the selection into the
Library category of the Assets panel.
- Click the New Library Item button at the bottom of the Assets
panel (in the Library category).
- Choose Modify > Library > Add Object to Library.
- Enter a name for the new library item.
Each library item is saved as a separate file
(with the file extension .lbi) in the Library folder of the site's
local root folder. |
|
Using JavaScript Behaviors
Dreamweaver behaviors place JavaScript code in
documents to allow visitors to interact with a web page to change
the page in various ways, or to cause certain tasks to be performed.
A behavior is a combination of an event with an action triggered
by that event. In the Behaviors panel, you add a behavior to a page
by specifying an action and then specifying the event that triggers
that action.
Note: Behavior code is client-side JavaScript
code; that is, it runs in browsers, not on servers.
Events are, effectively, messages generated by
browsers indicating that a visitor to your page has done something.
For example, when a visitor moves the pointer over a link, the browser
generates an onMouseOver event for that link; the browser then checks
to see whether there's some JavaScript code (specified in the page
being viewed) that the browser is supposed to call when that event
is generated for that link. Different events are defined for different
page elements; for example, in most browsers onMouseOver and onClick
are events associated with links, whereas onLoad is an event associated
with images and with the body section of the document.
An action consists of prewritten JavaScript code
that performs a specific task, such as opening a browser window,
showing or hiding a layer, playing a sound, or stopping a Shockwave
movie. The actions provided with Macromedia Dreamweaver MX are carefully
written by Dreamweaver engineers to provide maximum cross-browser
compatibility.
After you attach a behavior to a page element,
whenever the event you've specified occurs for that element, the
browser calls the action (the JavaScript code) that you've associated
with that event. (The events that you can use to trigger a given
action vary from browser to browser.) For example, if you attach
the Popup Message action to a link and specify that it will be triggered
by the onMouseOver event, then whenever someone points to that link
with the mouse pointer in the browser, your message pops up in a
dialog box.
A single event can trigger several different actions,
and you can specify the order in which those actions occur.
Dreamweaver MX provides about two dozen behavior
actions; additional actions can be found on the Macromedia Exchange
website as well as on third-party developer sites. You can write
your own behavior actions if you are proficient in JavaScript.
Note: The terms behavior and action are
Dreamweaver terms, not HTML terms. From the browser's point of view,
an action is just like any other piece of JavaScript code. |
|
|