PDA

View Full Version : Javascript code for widget that no longer exists


Firelight
02-08-2009, 10:07 PM
I created a master template with a left sidebar that has an editable region containing a vertical spry menu bar. At one point I cut the menu bar, put it somewhere else, and then replaced it into the editable region (too long ago to undo). Ever since then I have been getting the following message every time I open any page that descends from this template:

"This document contains Javascript code for a widget that no longer exists. If you don't remove the code, the browser might display JavaScript errors when loading the page. Would you like Dreamweaver to find all instances of this code for you?
Widget: var MenuBar=new
Spry.Widget.MenuBar("Menubar", {imgRight:"spryAssets/SpryMenuBarRightHover.gif"});

I am very new to Dreamweaver. I have tried clicking Yes and clicking No. the Yes gives me a list of results but doesn't change anything. "No" doesn't seem to do any damage.

Help? Thank you so much!

healingrooms
05-18-2009, 07:49 PM
I've been experiencing the same problem with Dreamweaver CS4.

I used the classic view and inserted a widget for a horizontal menu bar and a vertical menu bar. Each one experienced the same problem when opening the file with Dreamweaver:

QUOTE:

This document contains JavaScript code for a widget that no longer exists. If you don't remove the code, the browser might display JavaScript errors when loading the page. Would you like Dreamweaver to find all instances of this code for you?

Widget: var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});

Widget: var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});


I'm assuming this is just another case of Dreamweaver trying to read between the lines, but if this is a legitimate error message, please correct me.

edbr
05-19-2009, 02:35 AM
dw inserts piecece of code when you add a spry menu.
check your code,there is a block at the bottom of the page. I suspect it is still there

healingrooms
05-19-2009, 04:49 PM
Yes, that block at the bottom of the page is what the error message was referring to. But I don't think that Dreamweaver would insert that code and then later change its mind about what should or shouldn't be there.

This is the code it's referring to:

<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>

DWcourse
05-19-2009, 05:12 PM
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>

I suspect MenuBar1 was the original and MenuBar2 is the paste-in (even though they were the same menu. I'd try deleting

var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});

If that doesn't work replace it and try deleing varMenuBar2, etc.

edbr
05-20-2009, 01:59 AM
easy way to test is just comment it out and try

healingrooms
05-22-2009, 06:45 PM
I did comment out the lines, but Dreamweaver didn't acknowledge that they were commented out. Well, it did grey them out, as it does with all commented code, but when it tried analyzing the code when the file was opened, it didn't ignore that commented-out code.

When testing it in the browser with those lines commented out, I realized how vital they were to the functionality of the menu, rather than just preloading the images.

I guess we'll just have to cross our fingers that Dreamweaver CS5 will put a band aid on this problem and others.

DWcourse
05-22-2009, 06:51 PM
The actual javascript is already commented (for some compatibility issue I don't recall).

Did you try deleting just the menubar1 part (or the menubar2 part)? You can always paste it back in.

healingrooms
05-22-2009, 07:46 PM
I commented it out with //

I just now tried the alternative you recommended, deleting the code entirely. The results were the same, with the menu not spry-ing out during the mouseover.

So I think that the code which Spry recommends putting right before the closing body tag is essential to its operation, but Dreamweaver has a split personality (one half wanting to put the code there, and the other half not recognizing that it put the code there).