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

TabView embedded with javascript

Expand Messages
  • austintodo
    hi, i m using yui-tabView in my website, and I found that I can t use a page with javascript as an external source. for example: tabview.php, which is the main
    Message 1 of 3 , Dec 2, 2008
      hi, i'm using yui-tabView in my website, and I found that I can't use
      a page with javascript as an external source.
      for example:
      tabview.php, which is the main page with yui tabView.
      ----tabview.php----
      <script type="text/javascript">
      var tabView = new YAHOO.widget.TabView();
      tabView.addTab( new YAHOO.widget.Tab({
      label: 'A',
      dataSrc: 'a.php',
      cacheData: true,
      active: true
      }));
      ---end of tabview.php---
      a.php, which is a simple page with javascript:
      ----a.php----
      <html>
      <body>
      <script type="text/javascript">
      document.write("AAA");
      </script>
      </body>
      ---end of a.php---

      And I get nothing..
      Do I lost something?
      Thanks for helping!

      austin
    • Caridy Patino
      Hey Austin, There is a plugin called Dispatcher, that allow you to do that in the tabview, here is an article describing the whole functionality:
      Message 2 of 3 , Dec 2, 2008
        Hey Austin,

        There is a plugin called Dispatcher, that allow you to do that in the
        tabview, here is an article describing the whole functionality:

        http://yuiblog.com/blog/2008/11/03/tabview-dispatcher/

        Basically you need to change your code to delegate the loading process
        of the tab to the dispatcher, change this:

        tabView.addTab( new YAHOO.widget.Tab({
        label: 'A',
        dataSrc: 'a.php',
        cacheData: true,
        active: true
        }));

        for this:
        YAHOO.plugin.Dispatcher.delegate(new YAHOO.widget.Tab({
        label: 'A',
        dataSrc: 'a.php',
        cacheData: true,
        active: true
        }), tabView);

        And remember to include the dispatcher plugin JS code in your page.

        Also, you need to keep in mind that the content for the tab is a
        partial HTML, you don't need to have body/head in those html chunks,
        because the tabview injects that code in the current page.

        And one more thing, remember that you can not use document.write after
        the render of the page.

        Best Regards,
        Caridy Patino (caridy at yahoo-inc.com)
        Yahoo! LATAM

        --- In ydn-javascript@yahoogroups.com, "austintodo" <b94058@...> wrote:
        >
        > hi, i'm using yui-tabView in my website, and I found that I can't use
        > a page with javascript as an external source.
        > for example:
        > tabview.php, which is the main page with yui tabView.
        > ----tabview.php----
        > <script type="text/javascript">
        > var tabView = new YAHOO.widget.TabView();
        > tabView.addTab( new YAHOO.widget.Tab({
        > label: 'A',
        > dataSrc: 'a.php',
        > cacheData: true,
        > active: true
        > }));
        > ---end of tabview.php---
        > a.php, which is a simple page with javascript:
        > ----a.php----
        > <html>
        > <body>
        > <script type="text/javascript">
        > document.write("AAA");
        > </script>
        > </body>
        > ---end of a.php---
        >
        > And I get nothing..
        > Do I lost something?
        > Thanks for helping!
        >
        > austin
        >
      • austintodo
        it works now. Thank you very much!!
        Message 3 of 3 , Dec 3, 2008
          it works now.
          Thank you very much!!

          --- In ydn-javascript@yahoogroups.com, "Caridy Patino" <caridy@...> wrote:
          >
          > Hey Austin,
          >
          > There is a plugin called Dispatcher, that allow you to do that in the
          > tabview, here is an article describing the whole functionality:
          >
          > http://yuiblog.com/blog/2008/11/03/tabview-dispatcher/
          >
          > Basically you need to change your code to delegate the loading process
          > of the tab to the dispatcher, change this:
          >
          > tabView.addTab( new YAHOO.widget.Tab({
          > label: 'A',
          > dataSrc: 'a.php',
          > cacheData: true,
          > active: true
          > }));
          >
          > for this:
          > YAHOO.plugin.Dispatcher.delegate(new YAHOO.widget.Tab({
          > label: 'A',
          > dataSrc: 'a.php',
          > cacheData: true,
          > active: true
          > }), tabView);
          >
          > And remember to include the dispatcher plugin JS code in your page.
          >
          > Also, you need to keep in mind that the content for the tab is a
          > partial HTML, you don't need to have body/head in those html chunks,
          > because the tabview injects that code in the current page.
          >
          > And one more thing, remember that you can not use document.write after
          > the render of the page.
          >
          > Best Regards,
          > Caridy Patino (caridy at yahoo-inc.com)
          > Yahoo! LATAM
          >
          > --- In ydn-javascript@yahoogroups.com, "austintodo" <b94058@> wrote:
          > >
          > > hi, i'm using yui-tabView in my website, and I found that I can't use
          > > a page with javascript as an external source.
          > > for example:
          > > tabview.php, which is the main page with yui tabView.
          > > ----tabview.php----
          > > <script type="text/javascript">
          > > var tabView = new YAHOO.widget.TabView();
          > > tabView.addTab( new YAHOO.widget.Tab({
          > > label: 'A',
          > > dataSrc: 'a.php',
          > > cacheData: true,
          > > active: true
          > > }));
          > > ---end of tabview.php---
          > > a.php, which is a simple page with javascript:
          > > ----a.php----
          > > <html>
          > > <body>
          > > <script type="text/javascript">
          > > document.write("AAA");
          > > </script>
          > > </body>
          > > ---end of a.php---
          > >
          > > And I get nothing..
          > > Do I lost something?
          > > Thanks for helping!
          > >
          > > austin
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.