Problem manipulating html defined tabbar

Hi

I am having a problem manipulating the dhtmlx example tabbar that has been defined using html. When i add the setTabActive(“a2”) command as suggested in the docs i get “a_tabbar is not defined”.

<div id="a_tabbar" class="dhtmlxTabBar" imgpath="../../codebase/imgs/" style="width:390px; height:390px;">
    <div id="a1" name="Tab 1-1" width="100px">
		<img src="../common/page_a.gif">
	</div>
	<div id="a2" name="Tab 1-1"  width="100px">
		<img src="../common/page_b.gif">
	</div>
	<div id="a3" name="Tab 1-1"  width="100px">
		Content 3
	</div>
</div>
<script>
	a_tabbar.setTabActive("a2");
</script>

Eventually i want to attach an “onSelect” event to tab a2 when it is clicked.

Thanks
Wimac

Hi,

to define a selected tab you may use “select” attribute:

<div select="a2" id="a_tabbar" class="dhtmlxTabBar" imgpath="../../codebase/imgs/" style="width:390px; height:390px;">
....
</div>

However, there is also a possibily to use tabbar methods. You need to define “oninit” attribute, it sets function that will be called after intialization:

<div oninit="doOnInit()" id="a_tabbar" class="dhtmlxTabBar" imgpath="../../codebase/imgs/" style="width:390px; height:390px;">
...
</div>
<script>
function doOnInit(){
     /*a_tabbar is id of the tabbar container*/
     a_tabbar.attachEvent("onSelect",function(){
             /*your code*/
              return true
    })
    a_tabbar.setTabActive("a2");
}
</script>