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

Re: [ydn-javascript] Can't initialize menubar

Expand Messages
  • Eric Miraglia
    Josh, Menu is part of the Container family of controls, all of which are based on a markup structure that we call Standard Module Format. If you take a look
    Message 1 of 3 , Feb 2 7:33 AM
    • 0 Attachment
      Josh,

      Menu is part of the Container family of controls, all of which are based on a markup structure that we call Standard Module Format.  If you take a look at the Getting Started section of the Menu documentation, you'll see where Todd has laid out the markup hooks that Menu needs in order to operate on your <ul>.  In short, you need (at minimum) a main <div> that comprises the "module" and an inner <div> that comprises the body section of the module.  Your <ul> lives in the body of the module.  The ID that you pass to Menu's constructor is the ID of the main <div> element for the module.

      <script>
      var init = function() {
      var pageMenu = new YAHOO.widget.MenuBar("pageList");
      };
      YAHOO.util.Event.on(window, "load", init);

      </script>

      <div id="pageList">
      <div class="bd">
      <ul class="pageList">
      <li class="current">MAIN PAGE</li>
      <li class="user">ITUNES</li>
      <li class="add">ADD PAGE</li>
      </ul>
      </div>
      </div>

      Regards,
      Eric


      ______________________________________________
      Eric Miraglia
      Yahoo! User Interface Library



      On Feb 2, 2007, at 12:19 AM, Josh Santangelo wrote:

      I'm trying to create an instance of YAHOO.widget.MenuBar, but it dies
      before initializing. This is the error:

      this.beforeInitEvent has no properties yui/menu/menu.js
      Line 6563

      Below is the code for my page, which is using YUI Version 0.12.2.

      Help?

      thanks,
      -josh

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
      debug="false">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

      <!-- Original YUI libs -->
      <link type="text/css" rel="stylesheet"
      href="client/yui/fonts/fonts.css" />
      <link type="text/css" rel="stylesheet"
      href="client/yui/reset/reset.css" />
      <script type="text/javascript" src="client/yui/yahoo/yahoo.js"></script>
      <script type="text/javascript" src="client/yui/event/event.js"></script>
      <script type="text/javascript" src="client/yui/dom/dom.js"></script>
      <script type="text/javascript"
      src="client/yui/animation/animation.js"></script>
      <script type="text/javascript"
      src="client/yui/container/container_core.js"></script>
      <script type="text/javascript" src="client/yui/menu/menu.js"></script>
      <script type="text/javascript"
      src="client/yui/connection/connection.js"></script>

      <script type="text/javascript">

      window.onload = function() {
      var pageMenu = new YAHOO.widget.MenuBar("pageList");
      };

      </script>

      </head>
      <body>

      <ul class="pageList" id="pageList">
      <li class="current">MAIN PAGE</li>
      <li class="user">ITUNES</li>
      <li class="add">ADD PAGE</li>
      </ul>


      </body>
      </html>


    • Josh Santangelo
      Thanks for this. I got it working in the end -- I really shouldn t try to tackle new projects so late at night I suppose. Now to ask another question about
      Message 2 of 3 , Feb 2 5:44 PM
      • 0 Attachment
        Thanks for this. I got it working in the end -- I really shouldn't try
        to tackle new projects so late at night I suppose.

        Now to ask another question about menu events...

        -josh

        --- In ydn-javascript@yahoogroups.com, Eric Miraglia <miraglia@...> wrote:
        >
        > Josh,
        >
        > Menu is part of the Container family of controls, all of which are
        > based on a markup structure that we call Standard Module Format. If
        > you take a look at the Getting Started section of the Menu
        > documentation, you'll see where Todd has laid out the markup hooks
        > that Menu needs in order to operate on your <ul>. In short, you need
        > (at minimum) a main <div> that comprises the "module" and an inner
        > <div> that comprises the body section of the module. Your <ul> lives
        > in the body of the module. The ID that you pass to Menu's
        > constructor is the ID of the main <div> element for the module.
        >
        > <script>
        > var init = function() {
        > var pageMenu = new YAHOO.widget.MenuBar("pageList");
        > };
        > YAHOO.util.Event.on(window, "load", init);
        >
        > </script>
        >
        > <div id="pageList">
        > <div class="bd">
        > <ul class="pageList">
        > <li class="current">MAIN PAGE</li>
        > <li class="user">ITUNES</li>
        > <li class="add">ADD PAGE</li>
        > </ul>
        > </div>
        > </div>
        >
        > Regards,
        > Eric
        >
        >
        > ______________________________________________
        > Eric Miraglia
        > Yahoo! User Interface Library
        >
        >
        >
        > On Feb 2, 2007, at 12:19 AM, Josh Santangelo wrote:
        >
        > > I'm trying to create an instance of YAHOO.widget.MenuBar, but it dies
        > > before initializing. This is the error:
        > >
        > > this.beforeInitEvent has no properties yui/menu/menu.js
        > > Line 6563
        > >
        > > Below is the code for my page, which is using YUI Version 0.12.2.
        > >
        > > Help?
        > >
        > > thanks,
        > > -josh
        > >
        > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
        > > debug="false">
        > > <head>
        > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        > >
        > > <!-- Original YUI libs -->
        > > <link type="text/css" rel="stylesheet"
        > > href="client/yui/fonts/fonts.css" />
        > > <link type="text/css" rel="stylesheet"
        > > href="client/yui/reset/reset.css" />
        > > <script type="text/javascript" src="client/yui/yahoo/yahoo.js"></
        > > script>
        > > <script type="text/javascript" src="client/yui/event/event.js"></
        > > script>
        > > <script type="text/javascript" src="client/yui/dom/dom.js"></script>
        > > <script type="text/javascript"
        > > src="client/yui/animation/animation.js"></script>
        > > <script type="text/javascript"
        > > src="client/yui/container/container_core.js"></script>
        > > <script type="text/javascript" src="client/yui/menu/menu.js"></script>
        > > <script type="text/javascript"
        > > src="client/yui/connection/connection.js"></script>
        > >
        > > <script type="text/javascript">
        > >
        > > window.onload = function() {
        > > var pageMenu = new YAHOO.widget.MenuBar("pageList");
        > > };
        > >
        > > </script>
        > >
        > > </head>
        > > <body>
        > >
        > > <ul class="pageList" id="pageList">
        > > <li class="current">MAIN PAGE</li>
        > > <li class="user">ITUNES</li>
        > > <li class="add">ADD PAGE</li>
        > > </ul>
        > >
        > >
        > > </body>
        > > </html>
        > >
        > >
        > >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.