Diary Khansa: Membuat tab view di blog

! Diary Khansa: Membuat tab view di blog: Beberapa dekade yang lalu *jiah, dekade, baru juga minggu lalu* ada yang nanya ke gue gimana cara bikin tab view di blog. Pada tau tab view ...
<style type="text/css">
div.TabView div.Tabs
{height: 30px;overflow: hidden}
div.TabView div.Tabs a {float:left; display:block; width: 80px; /* lebar menu utama*/
text-align:center ; height: 26px; /* tinggi menu utama */
padding-top:3px; vertical-align:middle; border:1px solid
#BDBDBD; /* warna border atas */
border-bottom-width:0; text-decoration: none; font-family: "Verdana"; /* font menu yang di atas */
font-weight:bold; color:#000000; /* warna font menu yang di atas */
-moz-border-radius-topleft:10px; -moz-border-radius-topright:10px}
div.TabView div.Tabs a:hover, div.TabView div.Tabs a.Active
{background-color: #FFFFFF; /* warna background menu yang diatas */
}
div.TabView div.Pages {clear:both; border:1px solid #BDBDBD; /* warna border kotak utama */
overflow:hidden; background-color:#FFFFFF; /* warna background kotak utama */ }
div.TabView div.Pages div.Page {height:100%; padding:0px; overflow:hidden}
div.TabView div.Pages div.Page div.Pad {padding: 5px 5px}
</style>
<script type='text/javascript'>
//<![CDATA[
function tabview_aux(TabViewId, id)
{
var TabView = document.getElementById(TabViewId);
// ----- Tabs -----
var Tabs = TabView.firstChild;
while (Tabs.className != "Tabs" ) Tabs = Tabs.nextSibling;
var Tab = Tabs.firstChild;
var i = 0;
do
{
if (Tab.tagName == "A")
{
i++;
Tab.href = "javascript:tabview_switch('"+TabViewId+"', "+i+");";
Tab.className = (i == id) ? "Active" : "";
Tab.blur();
}
}
while (Tab = Tab.nextSibling);
// ----- Pages -----
var Pages = TabView.firstChild;
while (Pages.className != 'Pages') Pages = Pages.nextSibling;
var Page = Pages.firstChild;
var i = 0;
do
{
if (Page.className == 'Page')
{
i++;
if (Pages.offsetHeight) Page.style.height = (Pages.offsetHeight-2)+"px";
Page.style.overflow = "auto";
Page.style.display = (i == id) ? 'block' : 'none';
}
}
while (Page = Page.nextSibling);
}
// ----- Functions -------------------------------------------------------------
function tabview_switch(TabViewId, id) { tabview_aux(TabViewId, id); }
function tabview_initialize(TabViewId) { tabview_aux(TabViewId, 1); }
//]]>
</script>
<form action="tabview.html" method="get">
<div id="TabView" class="TabView">
<div style="width: 246px;" class="Tabs">
<a>Tab 1</a>
<a>Tab 2</a>
<a>Tab 3</a>
</div>
<div style="width:246px; height:250px; " class="Pages">
<div class="Page">
<div class="Pad">
ISI MENU TAB 1
</div>
</div>
<div class="Page">
<div class="Pad">
ISI MENU TAB 2
</div>
</div>
<div class="Page">
<div class="Pad">
ISI MENU TAB 3
</div>
</div>
</div>
</div>
</form>
<script type="text/javascript">
tabview_initialize('TabView');
</script>
 Hasilnya akan tampak seperti di bawah ini:


Comments

Popular posts from this blog

Pengalaman Ngurus SKCK di Kota Padang

Kartu Kehadiran Seminar Skripsi

Sweet Marriage Proposal I love :)