• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to activate tab with the help of div tag

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello all

I am using tab panel in my jsp .
For that when my responce come from back end
I have to activate second tab dynamically.
Here is my code for tab

html code

<div id='tab-container'>
<div class="tab-content" id="buyer">
Buy Services
</div>
<div class="tab-content" id="seller">
Sell Services
</div>
</div>

-----And Javascript code is--------

function ActivateTab(containerId, activeTabIndex)
{
alert('hi')
var i, tabContainer, tabContents;

tabContainer = document.getElementById(containerId);

if(tabContainer == null)
return;

tabContents = getChildElementsByClassName(tabContainer, 'tab-content');

alert(activeTabIndex)
if(tabContents.length > 0)
{
for(i = 0; i < tabContents.length; i++)
{
//tabContents[i].className = "tab-content";
tabContents[i].style.display = "none";
}

tabContents[activeTabIndex].style.display = "block";


tabList = document.getElementById(containerId + '-list');
tabs = getChildElementsByClassName(tabContainer, 'tab-item');
if(tabs.length > 0)
{
for(i = 0; i < tabs.length; i++)
{
tabs[i].className = "tab-item";
}

tabs[activeTabIndex].className = "tab-item tab-active";
tabs[activeTabIndex].blur();
}
}


}

So please help me how can i do. Can i write something in div tag for activate
tab.? If its possble then please help ma.


 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you post code, use code tags so it is formatted and easier to read.

Eric
reply
    Bookmark Topic Watch Topic
  • New Topic