SOURCE CODE: Tabbed Interface

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
  <title>Tabbed Interface | JavaScript Examples | UIZE JavaScript Framework</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="keywords" content="Uize.Widget.Options.Tabbed"/>
  <meta name="description" content="Add tabbed interfaces to your own Web pages. See how in this example. Some test links are provided to demo the programmatic interface of this widget."/>
  <link rel="alternate" type="application/rss+xml" title="UIZE JavaScript Framework - Latest News" href=""/>
  <link rel="stylesheet" href="../css/page.css"/>
  <link rel="stylesheet" href="../css/page.example.css"/>
  <link rel="stylesheet" href="../css/widget.tabs.css"/>
  <link rel="stylesheet" href="css/tabbed-interface.css"/>


<script type="text/javascript" src="../js/Uize.js"></script>

<h1 class="header">
  <a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
  <a href="../index.html" class="homeLinkText" title="UIZE JavaScript Framework home">UIZE JavaScript Framework</a>

<div class="main">
  <h1 class="document-title">
    <a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
    Tabbed Interface
    <div class="pageActionsShell">
      <div id="page-actions" class="pageActions"><a href="source-code/tabbed-interface.html" class="buttonLink">SOURCE</a></div>

  <!-- explanation copy -->

  <div class="explanation">
    <p>In this example, the markup for a tabbed interface is being wired up by an instance of <a href="../reference/Uize.Widget.Options.Tabbed.html"><code>Uize.Widget.Options.Tabbed</code></a>. Below the tabs are some links that execute snippets of code to demonstrate the programmatic interface of the widget. Because the tabs widget is a subclass of <a href="../reference/Uize.Widget.Options.html"><code>Uize.Widget.Options</code></a>, it provides a <code>value</code> state property in its interface. The <code>Changed.value</code> instance event for this property can be used to watch for changes in the selected tab. The property can be set to programmatically change the selected tab. Interact with both the tabs UI and the test links to see how they affect one another.</p>

  <!-- tabs UI -->

  <div class="tabShell">
    <div class="tabStubShell">
      <a id="page_tabs_option0" class="tabStub" href="javascript://">SOLAR</a>
      <a id="page_tabs_option1" class="tabStub" href="javascript://">WIND</a>
      <a id="page_tabs_option2" class="tabStub" href="javascript://">GEOTHERMAL</a>
      <a id="page_tabs_option3" class="tabStub" href="javascript://">EFFICIENCY</a>
      <a id="page_tabs_option4" class="tabStub" href="javascript://">TIDAL</a>
      <br style="clear:left;"/>
    <div class="tabBodyShell">
      <div id="page_tabs-option0TabBody" class="tabBodyInactive">
      <div id="page_tabs-option1TabBody" class="tabBodyInactive">
      <div id="page_tabs-option2TabBody" class="tabBodyInactive">
      <div id="page_tabs-option3TabBody" class="tabBodyInactive">
      <div id="page_tabs-option4TabBody" class="tabBodyInactive">

  <!-- programmatic interface examples -->

  <div class="programmaticInterface">
    <p><b>tabs.get ('value') == </b>'<span id="page-tabsValue"></span>'</p>
    <p><b>tabs.get ('tentativeValue') == </b>'<span id="page-tabsTentativeValue"></span>'</p>
      <b>Set the value for the tabs widget: </b>
      <a href="javascript://" class="linkedJs">tabs.set ({value:'solar'})</a>
      <a href="javascript://" class="linkedJs">tabs.set ({value:'wind'})</a>
      <a href="javascript://" class="linkedJs">tabs.set ({value:'geothermal'})</a>
      <a href="javascript://" class="linkedJs">tabs.set ({value:'efficiency'})</a>
      <a href="javascript://" class="linkedJs">tabs.set ({value:'tidal'})</a>

<script type="text/javascript">

Uize.require (
  function () {
    'use strict';

    /*** create the example page widget ***/
      var page = = UizeSite.Page.Example ({evaluator:function (code) {eval (code)}});

    /*** add the tabs child widget ***/
      var tabs = page.addChild (

    /*** some code for demonstrating the widget's programmatic interface ***/
      tabs.wire ({
          function () {page.setNodeInnerHtml ('tabsValue',tabs)},
          function () {page.setNodeInnerHtml ('tabsTentativeValue',tabs.get ('tentativeValue'))}

    /*** wire up the page widget ***/
      page.wireUi ();

    /*** initialize the tabs widget's values ***/
      tabs.set ({