Adding JavaScript in Dreamweaver 8


JavaScript allows you to add interactive elements to and perform scripted functions on Web pages. Adding JavaScript in Dreamweaver 8 is not difficult, and does not require you to know JavaScript programming.

In Dreamweaver 8, JavaScript is a "behavior" and is controlled through the Behaviours panel. You'll use the Behaviours panel when adding JavaScript in Dreamweaver 8 to a Web page you're working with.

To open the Behaviours panel, select Windows> Behaviours. Select the + button to activate a drop-down menu. The Add Behaviours drop down menu contains about two-dozen common JavaScript-controlled functions you may add to a page in Dreamweaver. Common functions like checking browser types and revisions, checking for a plug-in, displaying a Pop-up message, validating a form or going to a URL are examples of JavaScript behaviours you may add.

Each behaviour in the Add Behaviours menu has a dialogue box that enables you to specify the actions that should take place when a certain trigger is encountered. A trigger is an action that a visitor to your Web site may perform, such as clicking on a link, entering data into a form or mousing over a particular location on the page.

You'll find the Validate Form behaviour useful if you collect typed information from your visitors. The Validate Form behaviour can used to verify that data entered by a visitor is in the correct format or contains only valid data. Once you have configured the behaviour appropriately, select OK.

If the behaviour you want to add is not among the built-in JavaScript behaviours, you may select Get More Behaviours. This selection will take you to the Macromedia Dreamweaver Exchange Site. Here you'll find user-created JavaScript behaviours that you may download. One caution: not all behaviours at this location are free of charge, but you'll find that adding new behaviours to your Dreamweaver interface is easy when you visit this site.

You may also change a behaviour you have added to Dreamweaver 8. To modify an existing behaviour, find the behaviour you want to edit in Code View. Select it and it will appear in the list below the Add Behaviours button in the Behaviours panel. From this point, you may modify the order in which events occur, change the event that triggers an action or delete the behaviour altogether.


Leave a Reply