/************************************** dhtml Tabs version 1.0 last revision: 02.18.2003 steve@slayeroffice.com **************************************/ function initTabs() { tabText = new Array("tab one","tab two","tab three","tab four","tab five"); tabContent = new Array(); tabContent[0] = "This is the content for the first tab."; tabContent[1] = "This is the content for the second tab.<br>Here is an image:<br><img align=center src=\"http://slayeroffice.com/gr/office_logo.gif\">"; tabContent[2] = "This is the content for the third tab. <br><br>Here is an html element:<br><input type=\"text\">"; tabContent[3] = "This is the content for the fourth tab. You can place anything you want in here."; tabContent[4] = "This is the content for the fifth tab. <p><p>Nothing to see here."; activeTab = 0; mHTML = ""; x=0; for(i=0;i<tabText.length;i++) { i==activeTab?tHeight=21:tHeight=20; mHTML+='<div onClick="swapTab(' + i + ');" id="tab" name="tab" class="mTab" style="top:0px;left:' + x + ';height:' + tHeight + ';">' + tabText[i] +'</div>'; x+=document.all?67:71; } xtop = document.all?19:21; xwidth = document.all?x-2:x-15; mHTML += '<div id="tabContentContainer" style="width:' + (xwidth+65) + 'px;top:' + xtop + 'px;">' + tabContent[activeTab] +'</div>'; document.getElementById("tabContainer").innerHTML = mHTML; } function swapTab(tabID) { xDoc = document.getElementsByName("tab"); xDoc[tabID].style.height = "21px"; xDoc[activeTab].style.height="20px" document.getElementById("tabContentContainer").innerHTML = tabContent[tabID]; activeTab = tabID; } </script> <style stype="text/css"> .mTab { position:absolute; background-color:#C0C0C0; color:#000000; width:65px; height:20px; text-align:center; font-family:verdana; font-size:8pt; border-style:outset; border-width:2px; z-index:1; color:#000000; border-bottom-style:none; border-top-color:#FFFFFF; border-left-color:#FFFFFF; cursor:hand; } #tabContainer { position:relative; height:170px; } #tabContentContainer { position:absolute; font-family:verdana; font-size:9pt; border-style:outset; height:150px; padding:5px; z-index:0; background-color:#C0C0C0; border-top-color:#FFFFFF; border-left-color:#FFFFFF; border-width:2px; } </style> </head> <body onload="initTabs();"> <div id="tabContainer"></div>
![]() |
dHTML Tabs v1.0 last revision: 02.18.2003 steve@slayeroffice.com http://www.slayeroffice.com |