Solved

building sub-tabs

Posted on 2008-10-13
7
1,170 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:nigerman
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thank you, that's not what I was looking for but I thank you a lot for your efforts.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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 Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

743 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

15 Experts available now in Live!

Get 1:1 Help Now