Author : jackass
Put The Following Code Where You Want The Tabs To Be Appear :
Code
<style>
.tab_ul {list-style: none; margin:0px 0px 4px 0px;padding:0;}
.tab_ul li {margin-right:1px;}
.on {display:inline; border:1px solid #c2c2c2; border-bottom:0px; padding:5px;color:#000000; background-color:#FFFFFF; }
.off { display:inline; cursor:pointer; border:1px solid #c2c2c2; border-bottom:0px; padding:1px 5px 4px 5px;text-color:#000000; background-color:#ebebeb; color:#999999;}
.content_box_on {padding: 10px; margin-bottom:10px; border:1px solid #c2c2c2;color:#000000; background-color:#FFFFFF; display:block;}
.content_box_off {padding: 10px; margin-bottom:10px; border:1px solid #c2c2c2;text-color:#000000; background-color:#FFFFFF; display:none;}
</style>
<ul class="tab_ul">
<li id="tab_1" class="on" onClick="tab_1()">Title of 1. tab</li>
<li id="tab_2" class="off" onClick="tab_2()">Title of 2. tab</li>
<li id="tab_3" class="off" onClick="tab_3()">Title of 3. tab</li>
</ul>
<div class="content_box_on" id="cont1">Content of 1. tab</div>
<div class="content_box_off" id="cont2">Content of 2. tab</div>
<div class="content_box_off" id="cont3">Content of 3. tab</div>
<script type="text/javascript">
function tab_1(){
document.getElementById('cont1').className='content_box_on';
document.getElementById('cont2').className='content_box_off';
document.getElementById('cont3').className='content_box_off';
document.getElementById('tab_1').className='on';
document.getElementById('tab_2').className='off';
document.getElementById('tab_3').className='off';
}
function tab_2(){
document.getElementById('cont1').className='content_box_off';
document.getElementById('cont2').className='content_box_on';
document.getElementById('cont3').className='content_box_off';
document.getElementById('tab_1').className='off';
document.getElementById('tab_2').className='on';
document.getElementById('tab_3').className='off';
}
function tab_3(){
document.getElementById('cont1').className='content_box_off';
document.getElementById('cont2').className='content_box_off';
document.getElementById('cont3').className='content_box_on';
document.getElementById('tab_1').className='off';
document.getElementById('tab_2').className='off';
document.getElementById('tab_3').className='on';
}
</script>
How to edit or add more tabs :
Code
<style>
.tab_ul {list-style: none; margin:0px 0px 4px 0px;padding:0;}
.tab_ul li {margin-right:1px;}
.on {display:inline; border:1px solid #c2c2c2; border-bottom:0px; padding:5px;color:#000000; background-color:#FFFFFF; }
.off { display:inline; cursor:pointer; border:1px solid #c2c2c2; border-bottom:0px; padding:1px 5px 4px 5px;text-color:#000000; background-color:#ebebeb; color:#999999;}
.content_box_on {padding: 10px; margin-bottom:10px; border:1px solid #c2c2c2;color:#000000; background-color:#FFFFFF; display:block;}
.content_box_off {padding: 10px; margin-bottom:10px; border:1px solid #c2c2c2;text-color:#000000; background-color:#FFFFFF; display:none;}
</style>
Add more tabs :
Quote
<ul class="tab_ul">
<li id="tab_1" class="on" onClick="tab_1()">Title of 1. tab</li>
<li id="tab_2" class="off" onClick="tab_2()">Title of 2. tab</li>
<li id="tab_3" class="off" onClick="tab_3()">Title of 3. tab</li>
<li id="tab_
4" class="off" onClick="tab_
4()">Title of 4. tab</li>
<div class="content_box_on" id="cont1">Content of the 1. tab</div>
<div class="content_box_off" id="cont2">Content of the 2. tab</div>
<div class="content_box_off" id="cont3">Content of the 3. tab</div>
<div class="content_box_off" id="cont4">Content of the 4. tab</div>
It's easy, just add new row and change numbers, and title
But it's not all...
Code
function tab_4(){
document.getElementById('cont1').className='content_box_off';
document.getElementById('cont2').className='content_box_off';
document.getElementById('cont3').className='content_box_off';
document.getElementById('cont4').className='content_box_on';
document.getElementById('tab_1').className='off';
document.getElementById('tab_2').className='off';
document.getElementById('tab_3').className='off';
document.getElementById('tab_4').className='on';
}
You need to add new row here to,
Code
function tab_3(){
document.getElementById('cont1').className='content_box_off';
document.getElementById('cont2').className='content_box_off';
document.getElementById('cont3').className='content_box_on';
document.getElementById('cont4').className='content_box_off';
document.getElementById('tab_1').className='off';
document.getElementById('tab_2').className='off';
document.getElementById('tab_3').className='on';
document.getElementById('tab_4').className='off';
}