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: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:35

onmouseover, javascript, swap images


Poster: mstill
Dated: Tuesday June 11 2002 - 22:35:47 BST

The problem: I am trying to do the menu with images instead of text. So, each menu item has an on/off image and a link.

The question: can anyone tell me what is wrong with this code in mmenu_array.js:

Code:
,"<img src=home_off.gif border=0 name=home>","index.html onmouseover=javascript:document[\"home\"].src=\"home_on.gif\"",,,0 // "Description Text", "URL", "Alternate URL", "Status", "Separator Bar


I saw postings that dealt with javascripts for popup windows, but not with mouseover or mouseout AND javascript.



I have also tried it like this:

Code:
,"<img src=home_off.gif border=0 name=home>","index.html onmouseover=javascript:imgOn(\"home\")",,,0 // "Description Text", "URL", "Alternate URL", "Status", "Separator Bar"



This is calling a javascript function defined in the head tag which looks like

Code:
<SCRIPT LANGUAGE=javascript><!--
    function imgOn(imgName) {
        document[imgName].src = imgName + "_on.gif";
    }
//--></SCRIPT>



I also tried the swap-image tag in the menu, but no luck.

If anyone has run into this problem and has suggestions or solutions, please let me know.

\michael


Poster: Aquatoad
Dated: Tuesday June 11 2002 - 23:31:09 BST

Mstill,

I think the following will work (I pulled it from the sample):

,"<img src=image_up.gif border=0>","/url/here.html swapimage=image_over.gif",,,0

So just drop in the swapimage after the url

I'm basically doing the same thing, but I've got two images one swaping out and the other static. To do that, I just added a second img behind image_up. The problem is it the static image doesn't link to the url in IE 5. DOH! http://www.aquatoad.com/trane/homepage.html If anyone has any ideas there, feel free.

Hope that helps.
Toad.