paulmo Posted October 13, 2010 Share Posted October 13, 2010 I'm working with YUI Dropdown Menu Button and I need to link to pages, onclick, with no submit button. The dropdown menu button renders but I don't know how to set up links to pages corresponding to option values below. Note that for menu button below, type: "menu", not "link", yet I want the menu button to function as link to pages (ME, MA, NY etc.) But changing that to type: "link" renders button to a link button, not a dropdown menu button. This would not seem to be difficult, yet the docs don't show how to do this and their forum is unresponsive, so could someone PLEASE help me here? I've included the event listener code as I'm guessing this is how I'll get the link behavior? All YUI dependencies are in the head of my script. Thanks in advance for help. <input type="submit" id="menubutton1" name="menubutton1_button" value="State"><select id="menubutton1select" name="menubutton1select"> <option value="0//tried putting http address in here; doesn't work">ME</option> <option value="1">MA</option> <option value="2">NY</option> </select></center><script type="text/javascript">var oMenuButton1 = new YAHOO.widget.Button("menubutton1", { type: "menu", menu: "menubutton1select" }); //Click event listener for the second Button's Menu instance; not sure if this is necessary as I'm only using 1 button.var onMenuClick = function (p_sType, p_aArgs) { var oEvent = p_aArgs[0], // DOM event oMenuItem = p_aArgs[1]; // MenuItem instance that was the target of the event if (oMenuItem) { YAHOO.log("[MenuItem Properties] text: " + oMenuItem.cfg.getProperty("text") + ", value: " + oMenuItem.value); }};// Add a "click" event listener for the Button's MenuoMenuButton1.getMenu().subscribe("click", onMenuClick);</script> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.