Scripting Languages Differences
Although various browsers support different scripting languages, JavaScript is far and away the most supported language for putting executable content into web pages. Now with an international standard, called ECMAScript (the name JavaScript is owned by Netscape), different browser companies have taken to JavaScript as the language of choice for integrating into their browsers.
Just as different browsers use slightly different implementations of HTML, so do they use different versions of JavaScript. From the latest browsers using JavaScript 1.2 through older browsers using version 1.1, 1.0, or sometimes not at all, support for JavaScript varies from product to product.
Not only do different browsers use different versions of JavaScript, but they also chip in with their own interpretations of those versions. Just as browser programmers decided to invent their own tags, they also use their own twist on JavaScript properties and functions. Hardly anything is sacred.
JavaScript in Dreamweaver
The JavaScript used by Dreamweaver is carefully written to work with as many browsers as possible. Where code is too complex for a particular version of a browser to understand, the code fails without error. Although this is fantastic for developers in that they can be comfortable using JavaScript in Dreamweaver, safe in the knowledge that if a user visits their page with an older browser the user will not be presented with an error, it can have its downside as well.
To work in as many browsers as possible, Dreamweaver JavaScript uses a careful belt-and-braces approach to cater to different circumstances. For example, Internet Explorer and Netscape Navigator often need totally separate versions of a function to perform the same task. The downside is that, as a result, Dreamweaver outputs more code than you would have to if you knew all your visitors had the same browser.
For this reason, users of other software often criticize Dreamweaver JavaScript, saying that it is "bloated." The reality is, of course, that you actually have very tight cross-browser-compatible code that is going to cope with every eventuality.
JavaScript is applied to Dreamweaver pages primarily through the use of behaviors, but also by some commands. Behaviors consist of two distinct elements: an action and an event. The action is a JavaScript function that performs some task. It is inserted into the head of a page and is dormant until it is called. The event calls an action. Events describe the circumstance whereby the action is called. (You can spot them easily; most start with on). Examples of events are onClick, onMouseOver, onLoad, and onSubmit.
Commands in Dreamweaver can insert JavaScript (as well as other things) anywhere in your document. Commands are often used for more complex pieces of coding that don't just fall into the event and action model.
Although Dreamweaver built-in behaviors are very well written to cope with cross-browser compatibility, keep in mind that any extra behaviors that you might download and install from the Macromedia Exchange for Dreamweaver (http://www.macromedia.com/exchange/dreamweaver/) might not exhibit this attribute. As thorough and accurate as the code within them might be, there is no guarantee that the behaviors have been thoroughly checked for cross-browser compatibility unless they specifically state so. The way to get around thisas with any aspect of web developmentis to test at every stage. Nearly every web browser available is free to download, and so competent web developers have no excuse for not testing their work in every browser in which they expect their site to be viewed.
Tip
Although browsers are free to download, testing on other hardware platforms is a different matter. Many Internet cafes have a range of hardware that may differ from your own. Renting some time in one might save you an awful lot of redevelopment time later on.