Show/Hide div layers using menu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
bdaltilio
Advanced
Advanced
Posts: 15
Joined: Mon Oct 03, 2005 4:37 pm

Show/Hide div layers using menu

Post by bdaltilio »

I am trying to show and hide layers on a page by clicking on a menu item. See http://tempsite.texwipe.com/layer.asp for a example using javascript.

I would prefer to do it with milonic like the tramline menu. Is it possible and if so how?

Thanks
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

You can call a function in an aI string. I am not into functions but I can give you a couple of examples so you can see how it's done.

1. This will play a sound when you mouseover an item, in this one it requires that you put a dummy span on the page itself, since that is necessary for the function to work. Put this on an html page.

Code: Select all

<span id=dummyspan></span>
You can put this function either on the page or at the top of the menu_data.js file. If it's in the file, it will work on any page with the dummy span on it, if it's on the page it will only work on the pages where the function is.

Code: Select all

function DHTMLSound(surl) {
  document.getElementById("dummyspan").innerHTML=
    "<embed src='"+surl+"' hidden=true autostart=true loop=false>";
}
Then in the aI string you call the function like this,

Code: Select all

aI("text=Home;url=http://milonic.com/;onfunction=DHTMLSound('success.wav');");
In this case the function will fire on mouseover. If you wanted it to work onclick, you could put in

Code: Select all

clickfunction=DHTMLSound('success.wave');");
Here are a couple of demos on the Milonic site, one for putting a new item image based on a date, the other for changing the text of an item based on mouseover.

http://support.milonic.com/demos/timed_ ... /index.htm

http://support.milonic.com/demos/swap_text/index.htm

Hope this will give you some idea how to do it. I tried it, but since I don't know functions I just keep getting an error return something is outside function :?

Ruth
Post Reply