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

Re: menus and this.init is not a function

Expand Messages
  • Bryce Fischer
    Answering my own question. This: var mainMenu = YAHOO.widget.Menu( mainmenu ); becomes this: var mainMenu = new YAHOO.widget.Menu( mainmenu ); forgot the
    Message 1 of 2 , Jul 29, 2006
    • 0 Attachment
      Answering my own question.

      This:
      var mainMenu = YAHOO.widget.Menu("mainmenu");

      becomes this:
      var mainMenu = new YAHOO.widget.Menu("mainmenu");

      forgot the "new"...

      On 7/29/06, Bryce Fischer <bryce@...> wrote:
      > I am trying out the menus, and nothing happens. Using Firebug
      > extension for Firefox its showing: "this.init is not a function" in
      > container_core.js (line 454).
      >
      > Here is my (code):
      >
      > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
      > "http://www.w3.org/TR/html4/strict.dtd">
      > <html>
      > <head>
      > <title>Yahoo UI Menu Test</title>
      > <link rel="stylesheet" type="text/css" href="lib/YahooUI/fonts/fonts.css"/>
      > <link rel="stylesheet" type="text/css" href="lib/YahooUI/menu/assets/menu.css"/>
      >
      > <script type="text/javascript" src="lib/YahooUI/yahoo/yahoo.js"></script>
      > <script type="text/javascript" src="lib/YahooUI/event/event.js"></script>
      > <script type="text/javascript" src="lib/YahooUI/dom/dom.js"></script>
      > <script type="text/javascript"
      > src="lib/YahooUI/container/container_core.js"></script>
      > <script type="text/javascript" src="lib/YahooUI/menu/menu.js"></script>
      > <script type="text/javascript">
      > YAHOO.example.init = function() {
      > alert("Hello");
      > var mainMenu = YAHOO.widget.Menu("mainmenu");
      > alert("There");
      > };
      >
      > YAHOO.util.Event.onAvailable('mainmenu', YAHOO.example.init);
      >
      > </script>
      > </head>
      > <body id="animation-demo-colors">
      > <div id="mainmenu">
      > <div id="bd">
      > <ul>
      > <li class="yuimenuitem">Item 1</li>
      > <li class="yuimenuitem">Item 2</li>
      > <li class="yuimenuitem">Item 3</li>
      > <li class="yuimenuitem">Item 4</li>
      > <li class="yuimenuitem">Item 5</li>
      > </ul>
      > </div>
      > </div>
      > </body>
      > </html>
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.