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:34

need to run a custom function on pagematch [solved]


Poster: nwilcox
Dated: Saturday August 20 2005 - 6:18:56 BST

I am running onfunction and offfunction on one particular item within a menu and I also need to run a function on pagematch.

Is there a way I can do this?

My menu item has 2 words each colored a different color on the "over" state so to get this to work, I had to build a custom javascript function to change the colors. (which works great)

However, I need to run this function again to turn the colors on whenever there is a URL pagematch. PageColor won't cut it becuase I need to change the color of both words to different colors.

Any assistance would be appreciated or another approach I can take to run a function if there is a pagematch for this particular item in the menu.

aI("offcolor=#666666;offfunction=changeRollover(0);onfunction=changeRollover(1);status=CobraPLA;text=<img src=../images/spacer.gif width=5 height=1 border=0><div id=mnuOuter class=Cobra>Cobra</div><div id=mnuInner class=PLA><span class=thin>PLA</span></div><img src=../images/spacer.gif width=5 height=1 border=0>;url=?action=products&productid=6;pagematch=?action=products&productid=6;");

function changeRollover(rollOverType){
//alert('changeRollover(' + rollOverType + ')');
if (rollOverType == 1) {
document.getElementById("mnuOuter").className='CobraOn';
document.getElementById("mnuInner").className='PLAOn'
} else {
document.getElementById("mnuOuter").className='CobraOff';
document.getElementById("mnuInner").className='PLAOff';
}
}


thanks!!

any one have any ideas on my question?


Poster: nwilcox
Dated: Sunday August 21 2005 - 6:48:38 BST

I think I basically need a "pageFunction" Menu Item Property. Is that available?

or

can this be recreated?


my URL is on a development server so I am putting this out so you can see what I need to do

http://clients2.serverside.net/engmedsys/

rollover Airway to see the first menu item "CobraPLA"


Poster: Ruth
Dated: Sunday August 21 2005 - 15:16:07 BST

Hi,

To start, let me say I'm not a function person nor do I know much about css [so what am I doing posting here, right? :)] Wouldn't there be a way to do what you want using css and the pageclass function of the menu? The offfunction, onfunction and pageclass functions are also item properties. So, I'd think you could define a class to use and then in the item put pageclass=yourclass;

Ruth


Poster: Ruth
Dated: Sunday August 21 2005 - 15:57:30 BST

Hi,

Just adding a request for information to the previous post.

Could you tell me what you are trying to do? You seem to have a spacer image in most of your items as if you want to have no padding at the top or bottom and 5px right and left in the items? If that is correct, since you are using a stylesheet and class for some things, you can also use the stylesheet to set up padding the way you want it. You could make a class like that below in your stylesheet

Code:
.mmpadding{padding-top:0px, padding-right:5px;padding-bottom:0px;padding-left:5px}


Then in your various styles you would code offclass="mmpadding";onclass="mmpadding";

That should put 5px on the right and left of the text and you wouldn't need to use that spacer in each item. If there were an item that you didn't want to have that setup for the padding, because the offclass and onclass properties of the menu can be used in either the style section or the item section, you could code a class for the items that you wanted a different padding to apply and then just call the class in the item itself. The only difference would be that you don't use quotes when you call the class in the item. i.e. offclass=mmpadding;onclass=mmpadding.

Ruth


Poster: nwilcox
Dated: Sunday August 21 2005 - 16:10:34 BST

excellent point Ruth... I totally forgot out the onClass and offClass in the parent level

The crux of what I want to do is this:

I have a link within the menu item that needs 2 different colors on mouseover. Using onColor and pageColor won't work for what I need.

I need to change the word "Cobra" to a certain color on rollover
I need to change the word "PLA" to a certain color on rollover

According to how Milonic is designed, there are no menu level properties I can set to do that.

So.... I have to use the onFunction and offFunction properties to do that for me with a Javascript function I created. I wrap each word with a div tag and an add an "id". I reference both "id"s in the function and change each their class style to simulate the Milonic "onColor" property.

I need to recreate this rollover effect when there is a pagematch.

So as I mentioned earlier, is there a pageFunction property or something similar I can use?

pageClass will not work as I need to change 2 words to 2 different colors so a single class change will not work.

thanks


Poster: nwilcox
Dated: Sunday August 21 2005 - 17:34:04 BST

hi Ruth

I've figured out my issue.

I just ran the fuction on the parent menu item with onFunction and it works. :D

thank you for assistance on the other issue you found.