Solved

building sub-tabs

Posted on 2008-10-13
7
1,171 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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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 Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
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 …

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now