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

YUI Loader Relod Trouble

Expand Messages
  • coder_lol
    My home.jsp includes yui_proto_mainMenu.jsp which includes a javascript function to instantiate a yui menu from markup. The markup is also in the same file,
    Message 1 of 1 , Nov 4, 2007
    • 0 Attachment
      My home.jsp includes yui_proto_mainMenu.jsp which includes a
      javascript function to instantiate a yui menu from markup. The
      markup is also in the same file, but I have omitted them to save
      space.

      I am using the yuiloader and all works fine until I click
      on "reload" in the webbrowser. It seems like the initMainMenuBar()
      is not triggered when a page is reloaded. How would I re-code to
      ensure that a reload would also work?

      Thanks...

      ===home.jsp===
      <html>
      <head>
      <meta http-equiv="content-type" content="text/html;
      charset=utf-8">
      <title>YUI </title>

      <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/2.3.1/build/reset/reset-min.css">
      <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/2.3.1/build/base/base-min.css">
      <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/2.3.1/build/fonts/fonts-min.css">
      <link rel="stylesheet" type="text/css"
      href="http://yui.yahooapis.com/2.3.1/build/grids/grids-
      min.css">

      <!-- Load the YUILoader script: -->
      <script
      src="http://yui.yahooapis.com/2.3.1/build/yuiloader/yuiloader-beta-
      min.js"></script>
      <script type="text/javascript">
      var loader = new YAHOO.util.YUILoader();
      loader.require
      ("dom","dragdrop","element","event","container", "menu","yahoo");
      loader.loadOptional = true;

      loader.insert(function()
      {
      YAHOO.util.Event.onContentReady("body", function ()
      {

      initPage();
      });
      });
      </script>

      <script type="text/javascript">
      function initPage()
      {
      initMainMenuBar();

      }

      </script>
      </head>

      <body id="body">
      <!-- #doc4 = 974px width, centered -->
      <!-- t2 = non-main on left -->
      <div id="doc4" class="yui-t2">
      <div id="hd" style="height:120px;background-
      color:silver">
      HEADER 1
      </div>
      <div id="hd"><!-- header -->
      <div class="yui-skin-sam">
      <%@ include
      file="/components/yui_proto_mainMenu.jsp"%>
      </div>
      </div>
      <div id="bd"><!-- body -->
      <div id="yui-main">
      <div class="yui-b">
      <!-- ge=3/4 main, 1/4 right -->

      <div class="yui-ge">
      <div class="yui-u first"
      style="background-color:red">
      <div>
      Main
      /div>

      </div>
      <div class="yui-u" style="background-
      color:yellow">
      Right Block
      </div>
      </div>

      </div>
      </div>

      <div class="yui-b" style="background-color:blue">
      Left block
      </div>

      </div>
      <div id="ft" style="background-color:silver"><!--
      footer -->
      footer
      </div>
      </div>
      </body>

      </html>


      ===yui_proto_mainMenu.jsp===

      <script type="text/javascript">
      function initMainMenuBar()
      {
      var oMenuBar = new YAHOO.widget.MenuBar("productsandservices", {
      autosubmenudisplay: true, hidedelay: 500, lazyload: false });
      oMenuBar.render();
      }
      </script>

      <div id="productsandservices" class="yuimenubar yuimenubarnav">
      <div class="bd">
      <ul class="first-of-type">
      ...
      </div>
      </div>
      ====
    Your message has been successfully submitted and would be delivered to recipients shortly.