Extending Dreamweaver JavaScript Back Button | WebReference

Extending Dreamweaver JavaScript Back Button


Extending Dreamweaver

Macromedia Dreamweaver has long been my 'editor of choice' for creating Web sites. Every editing program I've used has had its limitations but Macromedia appears to have found a way to make its Web authoring tool almost limitless: they let you build it yourself.

The Dreamweaver program itself is built using HTML, JavaScript and XML; just like a Web page. This means that early Dreamweaver users were able to extend the abilities of the program and add commands and menu items that didn't exist. (it was possible, but it wasn't easy.) Macromedia has since started its 'Dreamweaver Exchange', making it as simple as downloading and double clicking the command you want to add. And some of these commands are pretty advanced.

Some of my favorites: A self-centering pop-up window. A premade calendar. JavaScript form field validation.

Advanced JavaScripts that used to take an hour to hand code now take me a couple clicks. You don't even need to KNOW JavaScript to add advanced features to your page. What you DO need:

A copy of Dreamweaver. A copy of Extensions Manager.

Here's where to find extensions:

Authorized*:

http://www.macromedia.com/exchange/dreamweaver/

Other*:

http://www.yaromat.com/ http://people.netscape.com/andreww/dreamweaver/customtags.html http://www.massimocorner.com/ http://www.projectseven.com/dreamweaver/index.htm http://dreamweaverfever.com/grow/ http://thecomb.tripod.com/dream.htm

Authorized Extensions vs. Unauthorized ones:

There are two kinds of extensions, 'authorized' and 'unauthorized.' Authorized means that the good people of Macromedia have checked it out and it appears to do what it says without causing any problems. Unauthorized means that it may work or it may give you errors. I've found a few that gave me errors but not many.

But I Want To Build My Own!

You can do this too. The easiest way is to find out how other people did it. Find an extension similar to yours, install it with Extensions Manager, then go looking for it on your hard drive. When I download an extension it usually ends up in C:\Program Files\Macromedia\Dreamweaver 3\Configuration\Objects\Invisibles.

A simple extension (or MXP file) is made up of three or four parts, with lots of variations:

  1. The HTML file that calls the JavaScript.
  2. The GIFs used
  3. The JavaScript that does the work.
  4. The MXI file that tells Extensions Manager who built it, what it is, and where to install it.

Here's a simple MXI File to insert a 'JavaScript back button'. Note that this is only one of the three files needed to build an extension:

<macromedia-extension id="99999" name="JavaScript Back Button" version="1.0.0" type="Object"><products><product name="Dreamweaver" version="3" primary="true"/></products><author name="Danny Mather"/><description/><ui-access/><files><file name="javaback.html" destination="$dreamweaver/configuration/objects/invisibles"/><file name="javaback.gif" destination="$dreamweaver/configuration/objects/invisibles"/></files><configuration-changes/></macromedia-extension>

If you look between the '' tag you can see where it tells Extensions Manager where to install the HTML file within the Dreamweaver folder.

TEXT CONTENT FOR JAVASCRIPT_BACK_BUTTON.HTML

<title>JavaScript Back Button</title><script language="javascript"> function objectTag() { // Return the html tag that should be inserted return '<a href="javascript:history.back();">' + document.forms[0].jback.value + ''; } </script>
  Enter text for back button: