Swapimage - could one do something to 'swaptext'?

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Swapimage - could one do something to 'swaptext'?

Post by Ruth »

I have used the swap image and it works fine, but I was wondering if it were possible to 'swaptext' using onMouseover? I'm sure I saw something somewhere about changing text on mouseover but I don't know if it could be done in the menu? It would be real nice as an option, save having to use images for swaps, save having to make different ones for different things if a text swap were possible. But, I have no idea if something like that is or if it's feasible. Thanks in advance. :D

Ruth
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

You're darn right its possible, isn't most anything! ;)
I looked and didnt see a menu function that would handle it, but try this out, it worked for me!

in the head of your page, put this in:

Code: Select all

<SCRIPT>
function changeText(id,toThis)
{id.innerHTML = toThis;}
</SCRIPT>
And then to make text change based on mouse over in the menu items, create your menu text field like so...pay attention to quotes and single quotes cuz we're trying to trick the menu. Also DO NOT put any semi colons after the javascript calls...andys script parses up your strings using semicolons and it totally screwed me for the longest time.

Code: Select all

aI("text=<span onMouseOut=\"changeText(this,'New Out Text')\" onMouseOver=\"changeText(this,'New In Text')\">Original Text</span>;url=http://www.example.com;");
Worked for me on a Win2000 machine using Internet Explorer 6. If you want it to work on other browsers, you may have to do alittle tweaking, but not too much I dont think. You're essentially putting alittle span tag in place of the next and telling it to change its innerText based on mouseOver and mouseOut, the menu has nothing to do with it.

Hope it works for you!!
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Ok i am stupid sometimes. I was dumb about two things.
(1)I totally forgot we are using the v3 of the menu here,
(2)If the menu is wider than the text, the onMouseOver only works on the text, not the entire menu so basically you could hover over part of the menu item, but the text wont change until you go over the text.
Heres the fixes
Below is how you would define a menu item in the menu:

Code: Select all

,"<table width=100% ><tr><td onMouseOut=\"changeText(this,'New Out Text')\" onMouseOver=\"changeText(this,'New In Text')\">Original Text</td></tr></table>","http://www.example.com onbordercolor=0000ff;offbordercolor=FFFFFF;",,"ExampleHome",0 
What I did differently here is first, changed it to version 3, so it should still render. The second thing is instead of a span tag, I used a table tag. This way I set the table to 100 % width and it consumes the entire menu item cell, so the mouseover will work everywhere within the item cell.

Sorry about the stupidity. Hope this works, let me know if you have problems!
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Ok, what the heck am I doing wrong? I put the code in but whenever I mouseover I get an error message that an object is expected.

I do have another option, I used it in the one down from this one..9-11, that's text and it imitates a 'mouseover' but uses image swap, I just put in a transparent 1x1 px image after the words and another image for the swap, but I'd like to get away from images. Text swap would mean not having to make new images to go with colors if I change those. Thanks so much for the help. [at some point I will be going up to 5, but not until I get the menu up and functioning as I want...it takes too long for me to figure out how to do things inside the menu]


Ruth :)
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

If you look at the post of mine before last, you will see where I defined a function called changeText....this is the 'object' that it can't find. When you have your mouse over events do function calls, they call a function object and if it can't find the reference or definition of it, it errors out. Take the code in that post, including the < SCRIPT > tags and paste it into your head of your document...it should work then. Everything else seems fine.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply