Solved

building sub-tabs

Posted on 2008-10-13
7
1,172 Views
Last Modified: 2012-05-05
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
Comment
Question by:nigerman
  • 4
  • 3
7 Comments
 
LVL 7

Expert Comment

by:ASPSQLServerCOM
ID: 22703043
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
 

Author Comment

by:nigerman
ID: 22703470
thanks for your prompt response.
I wanted to see the example but the link is broken.

Any link that works?
0
 
LVL 7

Expert Comment

by:ASPSQLServerCOM
ID: 22703610
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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:nigerman
ID: 22703735
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
 
LVL 7

Expert Comment

by:ASPSQLServerCOM
ID: 22704376
http://javascript.internet.com/miscellaneous/show-hide-a-div.html

click source code tab and you can see tab inside tab
0
 
LVL 7

Accepted Solution

by:
ASPSQLServerCOM earned 125 total points
ID: 22704508
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
 

Author Comment

by:nigerman
ID: 22754476
thank you, that's not what I was looking for but I thank you a lot for your efforts.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question