Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding "onclick" function in my submenu

Status
Not open for further replies.

MtDewPosterchild

Technical User
Joined
Jan 18, 2006
Messages
1
Location
US
Alrighty,
Here's what I'm lookin at here... I'm building a site for the chamber of commerce of the town in which i live... Long story short they want each business member of the chamber to have thier own page, but all they want on that page is the business' name, address, and any other contact info; Sound like a waste of time and space to anyone else? I have gotten this idea approved by the person who hired me, but I can't figure out how to execute it... Here is a sample of the code for the menu I am working with... It's a Trans-Menu I found on
//==================================================================================================
var menu2 = ms.addMenu(document.getElementById("Members"));
menu2.addItem("Sports & Recreation", "");
menu2.addItem("Food & Convenience","");
menu2.addItem("Real Estate","");
menu2.addItem("Financial, Legal, & Insurance","");
menu2.addItem("Organizations","");
menu2.addItem("Manufacturing & Fabricating","");
menu2.addItem("Vehicle Sales & Service","");
menu2.addItem("Lodging","");
menu2.addItem("Merchants & Shops","");
menu2.addItem("Medical","");
menu2.addItem("Services","");
menu2.addItem("Municipal & Utilities","");
menu2.addItem("Associate Members","");



var submenu1 = menu2.addMenu(menu2.items[0]);
submenu1.addItem("Blythes Scott Co. Museum","");
submenu1.addItem("Turkey Track Bluegrass Festival Park","");

//==================================================================================================

Ok, I know you're thinking that looks fairly simple... and that part is... but what I am getting at is instead of every business that I add on here taking up an entire page just to put contact info... I was thinking maybe adding an event handler to each item on the submenu... like "onclick" functions that would open up a DHTML tooltip or even a simple alertbox that had the name of the business and the contact info of the business. I have tried it every which way i could imagine... and it always winds up make the entire script not work... If ANYONE has ANY ideas... I would be MORE than grateful. Thank you. Josh
 
Modify the menu code (probably the addItem() function) to add an onclick (or onmouseover/onmouseout) event to the menu item as it is created. Maybe instead you could add a CSS class to each menu - and then (once the menu is created) loop through all page items with that class and add events.

Ideally... you should contact the original author and ask them if they have done this kind of thing.... or just write your own menu system... that way you won't be relying on hacking blind at someone else's code.

heers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
I would hesitate to use alert boxes for this sort of thing as (just coming at this from the point of view of a user) I am often frustrated by information on alert messages that I would otherwise like to highlight and copy for placement in an e-mail or something.

Alert messages can't be highlighted/copied.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top