Welcome to WebmasterWorld Guest from

Forum Moderators: open

Dreamweaver templates: inserted code vs external javascript file

6:46 pm on May 3, 2009 (gmt 0)

5+ Year Member

Hi there

I am designing a site in Dreamweaver using templates. These templates use rollover images. The code that DW uses for the rollover I have abstracted out into a separate javascript file, which is linked to in the header. Further, I am using window.onload() to call the preloader instead of the <body> onload event. All this works fine.

The problem is that every time I make a change to the template, DW re-inserts the rollover code into the head of the HTML file, and reinserts the preloader code into the <body> tag.

Is there a way I can prevent this from happening?


8:54 pm on May 3, 2009 (gmt 0)

5+ Year Member

Well, I have found the answer to half of my problem.

The structure of the rollover bit looks like this:

<a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','common/home2.jpg',0)"><img src="common/home1.jpg" name="home" width="61" height="25" border="0"></a>

The important bit is the ,0 at the end of the JS call MM_swapImage('home','','common/home2.jpg',0) which is the preloader flag. When set to 1, it preloads, and 0 it does not. So, I changed all the ,1 to ,0 in the rollover links in the templates, and presto, the onLoad method is gone.

So now I just have to find a way to keep the JS from being inserted.



Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved