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

Re: [ydn-javascript] TabView get tabs error

Expand Messages
  • Jing Ceawlin
    Sorry I didn t think very carefully. The problem is when you call new YAHOO.widget.TabView , the page haven t been fully loaded. The Dom element is still not
    Message 1 of 4 , Dec 26, 2007
      Sorry I didn't think very carefully.

      The problem is when you call "new YAHOO.widget.TabView", the page haven't been fully loaded. The Dom element is still not available. You should put your script block at the end of the page, before the ending body tag. Or, you can use YAHOO.util.Event.onDomReady to defer the execution.

      Regards

      On Dec 27, 2007 3:09 PM, gunardi.wu <gunardi.wu@...> wrote:

      Nope, not working.
      -G



      Jing Zhang wrote:
      >
      > Try "myTabs.cfg.get('tabs').length;"
      >
      > On Dec 27, 2007 2:17 PM, gunardi.wu <gunardi.wu@...
      > <mailto:gunardi.wu@...>> wrote:
      >
      > Hi--
      >
      > The HTML:
      >
      > <script type="text/javascript">
      > var myTabs = new YAHOO.widget.TabView("demo");
      > </script>
      >
      > <div id="demo" class="yui-navset">
      > <ul class="yui-nav">
      > <li class="selected"><a href="#tab1"><em>Tab One Label</em></a></li>
      > <li><a href="#tab2"><em>Tab Two Label</em></a></li>
      > <li><a href="#tab3"><em>Tab Three Label</em></a></li>
      > </ul>
      > <div class="yui-content">
      > <div><p>Tab One Content</p></div>
      > <div><p>Tab Two Content</p></div>
      > <div><p>Tab Three Content</p></div>
      > </div>
      > </div>
      >
      > The Problem:
      > adding this javascript below the myTabs init line:
      > var tabcount = myTabs.get('tabs').length;
      > will cause javascript error: myTabs.get('tabs') has no properties.
      >
      > The Questions:
      > Did I miss anything here? What's the correct way to get the number of
      > tabs in tabView?
      >
      > Thanks
      >
      > -Gunardi Wu
      >
      >
      >


    Your message has been successfully submitted and would be delivered to recipients shortly.