Using Dreamweaver's Interactive Javascript Behaviors
JavaScript is a simple, client-side scripting language which enables you to add exciting and interesting functionality to your HTML pages
. It is built in to most web browsers and, although it can be deactivated, most people will have it enabled within their browser. JavaScript's uses includes the validation of entries within an HTML form and the detection of browser versions and presence or absence of plug-ins. Dreamweaver's implementation of JavaScript centres on the use of what it calls "behaviors".
A behavior is simply a pre-written JavaScript function which can be triggered by a given event. To make the Behaviors window visible, choose Behaviors from the Window menu. Next select the element to which you want to attach the JavaScript. Finally, choose one of the available behaviors from the menu in Behaviors window. (The behaviors which are available will depend on the item you have highlighted.)
Whenever you attach a behavior to a web page element, Dreamweaver attempts to guess what the event which should trigger the JavaScript (mouse click, rollover, etc.). If Dreamweaver fails to assign the event that you actually want, simply choose a different event from the drop-down menu next to the event name.
Dreamweaver contains several types of JavaScript behaviors. Some relate to images, others display windows and messages, others can be used on forms and form fields and still others can be used to manipulate CSS attributes. To get a flavour of how behaviors work, let us examine a behavior in each of the above categories.
Perhaps the most frequently encountered JavaScript function is one that changes the appearance of an image when the mouse passes over it. Dreamweaver creates this functionality with the "Swap Image" behavior. You can also add this behavior automatically by choosing Insert - Image Objects - Rollover Image. Dreamweaver automatically adds a second behavior/function called "Restore Image" which changes the image back to the original when the mouse leaves the image.
In the alerts and windows category, we have Dreamweaver's "Open Browser Window" behavior. This creates the ever-popular pop-up window. When you assign the behavior, Dreamweaver asks you to choose the HTML page you would like displayed in the window as well as the attributes you would like to add or suppress, such as scroll bars or the ability to resize the window.
In the form manipulation behaviors category, we have "Set Text of Text Field" and "Validate Form". The "Validate Form" behavior only applies to text fields and enables you to ensure, first of all, that a field has not been left blank; secondly, that a field contains a valid email address; thirdly, that a field contains a numeric value; and, fourthly, that a field contains a number within a given range.
Dreamweaver contains a couple of very useful behaviors which manipulate the content of HTML elements. To use these, you need to give the element and ID (for example). The DIV element offers the greatest flexibility when using this behavior since it can contain just about anything you want. You highlight the element which will trigger the behavior and then choose Show/Hide Elements from the Behaviors panel menu. Click on any listed element then click either the Show or Hide button.
Naturally, there is some overhead involved in using Dreamweaver's behavior in terms of the code generated within your web page. To make your pages accessible and search engine friendly, it is recommended that you transfer JavaScript code into an external .js file and then link each of your web pages to the external JavaScript file. In Dreamweaver's code view, highlight all of the JavaScript code between the opening and closing SCRIPT tags, then choose Cut from the Edit menu. Create an empty text file, paste in all the code and save the file with a .js file extension. Finally, in the opening SCRIPT tag on your web page type src="myscript.js", replacing "myscript" with the name of your file.
by: Michael Charles
Better Business Plans With Internet Lead Marketing Why Are Majority Of Trump Network End Up Calling It A Scam Errorwiz 1.4 Crack Free Download Errorwiz Ebook Free Download 5 Essential Network Maintenance Tasks You Can Do Your Own Errorwiz Torrent Download Errorwiz Torrent Free Download Discount Coupons: Access To Almost Unlimited Savings At Your Own Disposal By The Internet Online Flight Simulation - What Makes A Skillful Internet Flight Simulator? The Simplest Way Spot An Exciting Carribean Islands Trip On The Internet To Reduce The Costs Without Reverse Phone Number Check-an Internet Service For Find Details Of A Phone Number The Best Tips Spot A Breathtaking Carribean Weekend On The Internet To Reduce The Costs Right Away Reverse Cell Phone Lookup Trace A Phone Number Legally Over The Internet