onmouseover, javascript, swap images

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
mstill
Beginner
Beginner
Posts: 6
Joined: Tue Jun 11, 2002 8:56 am
Location: California
Contact:

onmouseover, javascript, swap images

Post by mstill »

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: Select all

,"<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: Select all

,"<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: Select all

<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
Aquatoad
Beginner
Beginner
Posts: 5
Joined: Tue Jun 04, 2002 1:43 am

Post by Aquatoad »

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.
Post Reply