Step-by-Step Example
Using this sample page, we will add a navigation bar with image rollovers, form validation for our mailing list sign-up form, and link the thumbnail images to pop-up windows with the full size photos.
Getting Started
- Open the sample page
- Save the source of this page to your desktop as “gallery.html” (from the “File” menu, choose “Save As…”)
- Open the saved page in a browser window
- Startup Dreamweaver (if it’s not already running)
- Open the saved page in Dreamweaver
- Set-up your Dreamweaver environment in the following way:
- From the “View” menu, choose “Code and Design”
- From the “Window” menu, choose “Insert”
- From the “Window” menu, choose “Properties”
- From the “Window” menu, choose “Behaviors”
Form Validation
- In Dreamweaver, click inside the form somewhere
- In the status bar, click <form> to make sure you are acting on the form itself and not one of the elements within the form
- In the “Behaviors” window, click on the “+” (plus) sign and choose “Validate Form”
- Select the input for the user’s email address by clicking on the line labelled “text ‘email’ in form 0”
- Make the value required by selecting the appropriate checkbox
- Make it so the field only accepts an email address by selecting the appropriate radio button
- Click “OK” then save the file
- Go back to your browser window, reload, and try to submit your form without an email address!
Image Pop-ups
- In Dreamweaver, click on the leftmost thumbnail image
- In the “Behaviors” window, click on the “+” (plus) sign and, under “Show Events For”, choose “4.0 and Later Browsers”
- In the “Behaviors” window, click on the “+” (plus) sign and choose “Open Browser Window”
- Add the following address where the form asks for “URL to Display”:
- http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/gallery/ferns.jpg (hint: copy and paste the URL!)
- Enter 500 for the “Window Width” and 375 for the “Window Height”
- Give the window a name, you know … like “ferns”
- Click “OK”
- In the “Behaviors” window, where it says “onLoad”, click and change it to “(onClick)”
- Save the file
- Go back to your browser window, reload, and click on the ferns thumbnail!
- Repeat this process for the other two thumbnails using these URLs:
- http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/gallery/water.jpg
- http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/gallery/desert.jpg
Navigation Bar
- In Dreamweaver, click on the line just below “My Art Gallery”
- From the “Insert” palette, choose “Navigation Bar”
- Where it says “unnamed1” type the following: about
- Paste the following URL in the “Up Image” field:
- http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/about_inactive.gif
- Paste the following URL in the “Over Image” field:
- http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/about_active.gif
- Paste the following URL in the “Alternate Text” field:
- Paste the following URL in the “When Clicked, Go To URL” field:
- Click the “+” (plus) sign and repeat steps 3 through 7 using the following values:
- Element Name: exhibitions
- Up Image: http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/exhibitions_inactive.gif
- Over Image: http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/exhibitions_active.gif
- Alternate Text: Exhibitions
- Go To URL: exhbitions.html
- Click the “+” (plus) sign and repeat steps 3 through 7 using the following values:
- Element Name: pressroom
- Up Image: http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/press_inactive.gif
- Over Image: http://www.gwu.edu/~ahedges/javascript/examples/dreamweaver/images/press_active.gif
- Alternate Text: Pressroom
- Go To URL: pressroom.html
- Click “OK” then save the file
- Go back to your browser window, reload, and check out the nifty rollovers!
|