• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1184
  • Last Modified:

building sub-tabs

Greetings everyone:

I found the following scripts from the net. It is used to build tabbed pages.

My question is that I would like to use "sub-tabs" within each tab-page. Can this be done ?

If yes, can someone please give me an example of how to do this?

here is the current code that builds tabbed pages.
<!--#INCLUDE file= "../TabControl/TabControl.asp"-->
<%
'See if the default tab is passed to us
DefaultTab = Request.QueryString("Tab")
if DefaultTab = "" then
	DefaultTab = 2
else
	DefaultTab = cint(DefaultTab)
end if
 
' Declare and create our TabControl Object in memory
Dim MyTabControl, DefaultTab
Set MyTabControl = New TabControl
MyTabControl.TabType = TabTypeDynamic
MyTabControl.TabSelected = DefaultTab
MyTabControl.ControlImagePath = "../tabcontrol/"
MyTabControl.ControlScriptPath = "../tabcontrol/"
MyTabControl.TabWidth = "100"
MyTabControl.Width = "90%"
MyTabControl.Height = "800"
MyTabControl.OnClick = "countClicks('{0}');"
'We will just use the default value for the below properties
'MyTabControl.BGColor = "#F7F7F8"
%>
<head>
	<title>tabbed pages</title>
</head>
<script language="javascript">
var intClicks = 0;
 
function countClicks(strIndex) {
	intClicks +=1;
	document.getElementById("ClickCounter").innerHTML = intClicks +" (tab="+ strIndex +")";
}
</script>
<body topmargin="0" leftmargin="0" rightmargin="0">
<br>
	<center>
	<%
	'Add Tabs
	MyTabControl.AddTab "INTAKE","icon_company.gif","tab1"
	MyTabControl.AddTab "SUP","icon_user.gif","tab2"
	MyTabControl.AddTab "PARTNERS","icon_activity.gif","tab3"
	MyTabControl.AddTab "ADMIN","admin_icon.png","tab4"
	MyTabControl.AddTab "REPORTS","reportEx.gif","tab5"
	MyTabControl.AddTab "SEARCH","icon_search.gif","tab6"
	MyTabControl.AddTab "LOGOUT","logout.png","tab7"
 
	'Draw Tab Control
	MyTabControl.Draw
 
	'Add your content to div's which have the corresponding tab id as passed to AddTab
	%>
	<div id='tab1'>
	<!--#INCLUDE FILE="tab_tab1.asp"-->
	</div>
	<div class=TabContent id="tab2">
	<!--#INCLUDE FILE="tab_tab2.asp"-->
	</div>
	<div id="tab3">
	<!--#INCLUDE FILE="tab_tab3.asp"-->
	</div>
	<div id='tab4'>
	<!--#INCLUDE FILE="tab_tab4.asp"-->
	</div>
	<div class=TabContent id="tab5">
	<!--#INCLUDE FILE="tab_tab5.asp"-->
	</div>
	<div id="tab6">
	<!--#INCLUDE FILE="tab_tab6.asp"-->
	</div>
	<div id='tab7'>
	<!--#INCLUDE FILE="tab_tab7.asp"-->
	</div>
 
	<font face='arial' size='2'>Optional tab width is set to make the tabs the same size and OnClick event used in this demo.<br>
	OnClick event counter: <span id="ClickCounter">0</span>
	</font>
	</center>
</body>
</html>

Open in new window

0
nigerman
Asked:
nigerman
  • 4
  • 3
1 Solution
 
ASPSQLServerCOMCommented:
hi
its better you can write your own code using javascript and DIV

please refer the below link from that you can write your own sub tab inside tab

http://www.aliroman.com/article/how-to-create-web-tabs-with-javascript-show-hide-layers-34-1.html

tab control is simple DIV show hide using the javascript
0
 
nigermanAuthor Commented:
thanks for your prompt response.
I wanted to see the example but the link is broken.

Any link that works?
0
 
ASPSQLServerCOMCommented:
Hi,

The link above it working but the link inside to that page is not work and I know that, I gave the above link to you to get idea on how to build the tab control using DIV and Javascript and it require you to work on it, try to write your logic and if you get stuck then feel free to post your code where you are stuck and experts are there to assist you
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
nigermanAuthor Commented:
Well,

For me,it is hard to use that example to write mine when even the example they gave doesn't work, and I am not talking about the broken link.

I have gobbled together the example shown on that page and it doesn't even show on the screen.
0
 
ASPSQLServerCOMCommented:
http://javascript.internet.com/miscellaneous/show-hide-a-div.html

click source code tab and you can see tab inside tab
0
 
ASPSQLServerCOMCommented:
the link
http://www.aliroman.com/article/how-to-create-web-tabs-with-javascript-show-hide-layers-34-1.html

code


<HTML>
<head>
<style type="text/css">
<!--
.tab_hover {
background-color:blue;
color:white;
cursor:pointer;
width:137px;
height:20px;
background-image:url(./images/ltab_blue.gif);
border:0px;
text-align:center;
font-family:verdana;
font-size:12px; 
font-weight:bold;
}
.tab {
background-color:blue;
color:white;
cursor:pointer;
width:137px;
height:20px; 
background-image:url(./images/ltab_blue2.gif);
border:0px;
text-align:center;
font-family:verdana;
font-size:12px; 
font-weight:none;
}
.data_tab {
border:1px solid gray; 
width:500px;
height:100px;
text-align:left;
font-family:verdana;
font-size:12px; 
padding:.3em;
}
-->
</style>
</HEAD>
<script type="text/javascript">
<!--
  // Tabber created by: Patrick Fitzgerald | http://www.barelyfitz.com
  document.write('<style type="text/css">.tabber{display:none;}<\/style>');
 
var last_tab = 'tab1';
function show(layerName) { 
	document.getElementById(layerName).style.display = '';
} 
 
function hide(layerName) { 
	document.getElementById(layerName).style.display = 'none';
} 
 
function show_next(tab_name) {
	document.getElementById(last_tab).className = 'tab';
	var curr = document.getElementById(tab_name);
	curr.className='tab_hover';
	hide(last_tab+'_data');
	show(tab_name+'_data');
	last_tab=tab_name;
}
//-->
</script>
<body>
<table cellpadding=0 cellspacing=0 border=0>
<tr> 
<td id=tab1 class=tab_hover onclick="javascript:show_next('tab1')">Football</td>
<td id=tab2 class=tab onclick="javascript:show_next('tab2')">Basketball</td> 
<td id=tab3 class=tab onclick="javascript:show_next('tab3')">Lacrosse</td> 
</tr>
<tr> 
<td valign="top"> 
<div id=tab1_data>
$tab1_data
</div>
</td>
<td>
<div id=tab2_data style='display:none'>
$tab2_data
</div>
</td>
<td>
<div id=tab3_data style='display:none'>
$tab3_data
</div>
</td>
</tr>
<tr>
<TD>
<input type=button onclick="javascript:show_next('tab1')" value='Select Tab1'>
</td>
<td>
<input type=button onclick="javascript:show_next('tab2')" value='Select Tab2'>
</td>
<td>
<input type=button onclick="javascript:show_next('tab3')" value='Select Tab3'>
</tr>
</table>
 
</body></html>

Open in new window

0
 
nigermanAuthor Commented:
thank you, that's not what I was looking for but I thank you a lot for your efforts.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now