Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:00

onfunction/offfunction image switching using a 'swap' script


Poster: simongdawson
Dated: Sunday December 26 2004 - 18:47:13 GMT

Hi Guys,

I have a problem Milonic Menu v5 to do with onfunction/offfunction image switching (using a 'swap' script). This can be seen by going to my home page http://www.the-limes.com and sliding your mouse to the flashing MENU and then sliding down to the 'Simon's Work' entry on the submenu. You will see that a graphic appears at the bottom left corner of the screen when you hold your mouse over 'Simon's work'. Now move your cursor over the submenu and click one of the items, maybe, for example, 'Information'. Now on the new page repeat the above procedure. This time when you hold your mouse over 'Simon's work' you will not get the image displayed at the bottom left corner of the screen, but you will get a java error
notice:

Line: 21
Character: 5512
Error: Object Expected
Code: 0

I want to use lots of different images for different menu items, but I only have the one image linked to at the moment so as not to muddy the water.

My menu display is created by three scripts:

menu_data.js
Code:
_menuCloseDelay=500;
_menuOpenDelay=150;
_scrollAmount=3;
_scrollDelay=20;
_followSpeed=5;
_followRate=50;
_subOffsetTop=5;
_subOffsetLeft=10;

with(menuStyle=new mm_style()){
offcolor="#228B22";
offbgcolor="#FFFFF0";
oncolor="#FF0000";
onbgcolor="#FFFFF0";
fontsize="14";
fontstyle="normal";
fontweight="bold";
fontfamily="Tahoma,Helvetica,Verdana";
padding=2;
}

with(milonic=new menuname("TopMenu")){
top=10;
left=10;
itemwidth=90;
style=menuStyle;
alwaysvisible=1;
followscroll=1;
orientation="horizontal";
aI("image=/images/flashing_menu.gif;showmenu=SubMenu;url=#;align=right;status=Mouse over for menu;");
}

with(milonic=new menuname("SubMenu")){
itemwidth=110;
style=menuStyle;
aI("text=Simon's Work;onfunction=swap('/images/menu_work.gif');offfunction=swap('/images/menu_blank.gif');showmenu=WorkMenu;status=Mouse over to see menu for Simon's work;");
aI("text=Genealogy;showmenu=GenealogyMenu;status=Mouse over for Genealogy menu;");
aI("text=Contacts;showmenu=ContactMenu;status=Mouse over for Contacts menu;");
aI("text=Links;showmenu=LinksMenu;status=Mouse over to see Links menu;");
aI("text=Guest Book;url=http://www.the-limes.com/guestbook/index.php;status=Click to go to our Guest Book;");
aI("text=Search;url=http://www.the-limes.com/search/search.html;status=Click to search within our web site;");
aI("text=Acknowledgements;url=http://www.the-limes.com/acknowledgements/acknowledgements.html;status=Click to see Acknowledgements;");
aI("text=Webmaster;url=simon __at__ the-limes.com;status=Click to email Simon;");
}

with(milonic=new menuname("EmailMenu")){
itemwidth=60;
style=menuStyle;
aI("text=Thelma;url=tdawson __at__ the-limes.com;status=Click to email Thelma;");
aI("text=Simon;url=simon __at__ the-limes.com;status=Click to email Simon;");
}

with(milonic=new menuname("TelephoneMenu")){
itemwidth=95;
style=menuStyle;
aI("text=From UK;url=http://www.the-limes.com/contact/uk_phone.html;status=Click for our home telephone number from within the UK;");
aI("text=From abroad;url=http://www.the-limes.com/contact/abroad_phone.html;status=Click for our home telephone number from outside the UK;");
}

with(milonic=new menuname("LinksMenu")){
itemwidth=140;
style=menuStyle;
aI("text=Software;url=http://www.the-limes.com/links/software_links.html;status=Click to see links to software related sites;");
aI("text=Work;url=http://www.the-limes.com/links/work_links.html;status=Click to see links to work related sites;");
aI("text=Genealogy;url=http://www.the-limes.com/links/genealogy_links.html;status=Click to see links to genealogy related sites;");
aI("text=Chalfont St Peter;showmenu=CSPMenu;status=Mouse over for Chalfont St. Peter links;");
}

with(milonic=new menuname("GenealogyMenu")){
itemwidth=125;
style=menuStyle;
aI("text=Surname List;url=http://www.the-limes.com/genealogy/tng/surnames.php;status=Click to search our Surname list;");
aI("text=Name Search;url=http://www.the-limes.com/genealogy/tng/index.php;status=Click to search for individuals;");
aI("text=Advanced Search;url=http://www.the-limes.com/genealogy/tng/searchform.php;status=Click to search with advanced options for individuals;");
aI("text=Whats New;url=http://www.the-limes.com/genealogy/tng/whatsnew.php;status=Click to see what additions have been made to the database in the last year;");
aI("text=Links;url=http://www.the-limes.com/links/genealogy_links.html;status=Click to see links to genealogy related sites;");
}

with(milonic=new menuname("ContactMenu")){
itemwidth=90;
style=menuStyle;
aI("text=Email;showmenu=EmailMenu;status=Mouse over for email menu;");
aI("text=Mail;url=http://www.the-limes.com/contact/address.html;status=Click for mailing address;");
aI("text=Telephone;showmenu=TelephoneMenu;status=Mouse over for telephone menu;");
}

with(milonic=new menuname("WorkMenu")){
itemwidth=100;
style=menuStyle;
aI("text=Information;url=http://www.the-limes.com/work/work.html;status=Click to view information about Simon's work;");
aI("text=Links;url=http://www.the-limes.com/links/work_links.html;status=Click for work related links;");
aI("text=Photographs;url=http://www.the-limes.com/images/albums/work/index.html;status=Click to view photographs of some of Simon's work projects;");
aI("text=Testimonials;url=http://www.the-limes.com/work/testimonials.html;status=Click to view testimonials from some of Simon's customers;");
}

with(milonic=new menuname("CSPMenu")){
itemwidth=150;
style=menuStyle;
aI("text=CSP co uk;url=http://www.chalfontstpeter.co.uk;status=click to go to Chalfont St Peter co uk website;");
aI("text=CSP org uk;url=http://www.chalfontstpeter.org.uk;status=click to go to Chalfont St Peter org uk website;");
}

drawMenus();


menu_data.php
Code:
with(menuStyle2=new mm_style()){
offcolor="#000000";
offbgcolor="#FFFFF0";
oncolor="#000000";
onbgcolor="#FFFFF0";
fontsize="10pt";
fontstyle="normal";
fontweight="normal";
fontfamily="Tahoma, Helvetica, Verdana";
padding=2;
}

with(milonic=new menuname("BottomMenu")){
left=10;
top=300;
itemwidth=150;
style=menuStyle2;
screenposition="bottom";
alwaysvisible=1;
followscroll=1;
aI("text=<script language='JavaScript'>dT();</script>;align=left;status=The current time and date in Chalfont St. Peter;");
aI("text=<img border=0 src=http://opi.yahoo.com/online?u=simongoodhughdawson&m=g&t=2>;url=simon __at__ the-limes.com;align=left;status=Click to email Simon;");
aI("text=<? include("g:/websites/the-limes/htdocs/online/online.php");?><br>;align=left;status=The number of visitors to the-limes.com currently online;");
aI("text=<? include("g:/websites/the-limes/htdocs/online/today.php");?><br><br>;align=left;status=The number of visitors to the-limes.com today;");
aI("text=<img border=0 name=menupic src=http://www.the-limes.com/images/menu_blank.gif>;align=left;");
}

drawMenus();


mouse_over.js
Code:
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);

function swap(imgPath){
if (document.images) document.images['menupic'].src=imgPath;
}


If anyone can help me sort out this long running seemingly insoluble problem I will be very indebted (if not to say very surprised.....)

Simon


Poster: Ruth
Dated: Sunday December 26 2004 - 21:07:31 GMT

Hi,
I'm moving this to the Help and Support Version 5 forum.


Poster: Andy
Dated: Wednesday December 29 2004 - 10:15:04 GMT

Simon,

Could this problem be because you don't have the following on the "Information" page?

<script language="JavaScript" src="/java/mouse_over.js"></script>

Seems that the system is having trouble finding the swap function.

-- Andy


Poster: simongdawson
Dated: Thursday December 30 2004 - 20:59:05 GMT

Andy,

You are a star, and I am a complete wally. Thank you so much for finding my html error which was causing the problem. The Milonic script was behaving perfectly, after all. Happy New Year, Maestro!