Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by sea on May 29, 2008 05:19
open dhtmlx forum
onSelectHandler does not work!

////////////////////////////////////////////
onSelectHandler work very good as next code :

<div id="a_tabbartab" style="width:1024; height:840;"/>

<script>

function my_func(idn,ido){
    try{
        alert(idn);
        var idxTab = 0;
        if(idn == "task_tab1"){
            idxTab=0;
        }else if(idn == "task_tab2"){
            idxTab=1;
        }else if(idn == "task_tab3"){
            idxTab=2;
        }
        
        document.frames[idxTab].doTabSelected();
    }catch(e){
        //alert(e.name + ": " + e.message);
    }
    return true;
}


tabbar=new dhtmlXTabBar("a_tabbartab","top");
tabbar.setHrefMode("iframes-on-demand");
tabbar.setImagePath("<%=request.getContextPath()%>/jsp/resource/images/tabpage/");
tabbar.setOnSelectHandler(my_func);

tabbar.addTab("task_tab1","test1");
tabbar.setContentHref("task_tab1","<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB1");
tabbar.addTab("task_tab2","test2");
tabbar.setContentHref("task_tab2","<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB2");
tabbar.addTab("task_tab3","test3");
tabbar.setContentHref("task_tab3","<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB3");

tabbar.setTabActive("task_tab1");
tabbar.showTab("task_tab1");


////////////////////////////////////////////
but onSelectHandler does not work as next code :

<div id="a_tabbartab" hrefmode="iframes-on-demand" class="dhtmlxTabBar" imgpath="<%=request.getContextPath()%>/jsp/resource/images/tabpage/" style="width:100%;height:100%;" skinColors="#F2F7F8,#F4F3EE" oninit="a_tabbartab.setTabActive('task_tab2');a_tabbartab.setOnSelectHandler(my_func);">

<div id="task_tab1" width="120" height="30" name="tab1" href="<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB1"></div>

<div id="task_tab2" width="120" height="30" name="tab2" href="<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB2"></div>

<div id="task_tab3" width="120" height="30" name="tab3" href="<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB3"></div>

</div>


//////////////////////////////////
or next code does not work too :

<div id="a_tabbartab" hrefmode="iframes-on-demand" class="dhtmlxTabBar" imgpath="<%=request.getContextPath()%>/jsp/resource/images/tabpage/" style="width:100%;height:100%;" skinColors="#F2F7F8,#F4F3EE" >

<div id="task_tab1" width="120" height="30" name="tab1" href="<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB1"></div>

<div id="task_tab2" width="120" height="30" name="tab2" href="<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB2"></div>

<div id="task_tab3" width="120" height="30" name="tab3" href="<%=request.getContextPath()%>/Login_Tab.do?actionName=TAB_MY_JOB3"></div>

</div>

<script>

function my_func(idn,ido){
    try{
        alert(idn);
        var idxTab = 0;
        if(idn == "task_tab1"){
            idxTab=0;
        }else if(idn == "task_tab2"){
            idxTab=1;
        }else if(idn == "task_tab3"){
            idxTab=2;
        }
        
        document.frames[idxTab].doTabSelected();
    }catch(e){
        //alert(e.name + ": " + e.message);
    }
    return true;
}


tabbar=new dhtmlXTabBar("a_tabbartab","top");
tabbar.setHrefMode("iframes-on-demand");
tabbar.setImagePath("<%=request.getContextPath()%>/jsp/resource/images/tabpage/");
tabbar.setOnSelectHandler(my_func);

</script>



/////////////////////////////////
i must use iframes-on-demand HrefMode.

dhtmlXTabbar is a very very good !

thanks.
Answer posted by Support on May 29, 2008 09:29
Actually the second part of initialization works correctly
Please check attached sample, it uses the same init code as you second snippet and works correctly .
( The third snippet is incorrect, you can't init combo from the JS and HTML code in the same time )
Attachments (1)
Answer posted by sea on May 29, 2008 21:26
thanks very much!