Loading ...
Sorry, an error occurred while loading the content.

Menu button - getValue

Expand Messages
  • mona_yazbeck
    Hi, I have a simple menu button and I would like to get the value associated with the option I selected. I don t know how, can you help? Here s my code:
    Message 1 of 2 , Sep 29, 2008
    View Source
    • 0 Attachment
      Hi,

      I have a simple menu button and I would like to get the value
      associated with the option I selected. I don't know how, can you help?
      Here's my code:

      <input type="button" id="b_supprimer" name="b_supprimer"
      value="Delete...">
      <select id="b_menu" name="b_menu" >
      <option value="0">Emails</option>
      <option vaule="1">Contacts</option>
      </select>

      <script type="text/javascript">

      var oMenuButton = new YAHOO.widget.Button("b_supprimer",
      {
      type: "menu",
      menu:"b_menu"
      });

      oMenuButton.getMenu().subscribe('click', function(eType, o) {
      if (YAHOO.lang.isObject(o[1]) === false || o[1].element.tagName !
      == 'LI') {
      return;
      }
      oMenuButton.set('label', o[1].cfg.getProperty('text')); });

      //?????????????
      alert(o[1].cfg.getProperty('value'));


      </script>

      Thanks,

      Mona
    • mona_yazbeck
      Found it: var opt = o[1].srcElement; var theValue = opt.value; ... help? ... [1].element.tagName !
      Message 2 of 2 , Sep 30, 2008
      View Source
      • 0 Attachment
        Found it:

        var opt = o[1].srcElement;
        var theValue = opt.value;


        --- In ydn-javascript@yahoogroups.com, "mona_yazbeck" <m_yazbeck@...>
        wrote:
        >
        > Hi,
        >
        > I have a simple menu button and I would like to get the value
        > associated with the option I selected. I don't know how, can you
        help?
        > Here's my code:
        >
        > <input type="button" id="b_supprimer" name="b_supprimer"
        > value="Delete...">
        > <select id="b_menu" name="b_menu" >
        > <option value="0">Emails</option>
        > <option vaule="1">Contacts</option>
        > </select>
        >
        > <script type="text/javascript">
        >
        > var oMenuButton = new YAHOO.widget.Button("b_supprimer",
        > {
        > type: "menu",
        > menu:"b_menu"
        > });
        >
        > oMenuButton.getMenu().subscribe('click', function(eType, o) {
        > if (YAHOO.lang.isObject(o[1]) === false || o
        [1].element.tagName !
        > == 'LI') {
        > return;
        > }
        > oMenuButton.set('label', o[1].cfg.getProperty('text')); });
        >
        > //?????????????
        > alert(o[1].cfg.getProperty('value'));
        >
        >
        > </script>
        >
        > Thanks,
        >
        > Mona
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.