Link til side med "tabs"
HejsaNedenstående er koden til en side med "tabs" som jeg vil bruge...
Problemet er bare at jeg gerne vil have et link på en anden side som linker direkte til nedenstående kode. Dvs et link som åbner tabs-siden med tab1-aktiveret
Desuden et link som åbner tabs-siden med tab2-aktiveret
Kan man det...
<SCRIPT LANGUAGE=JavaScript>
//a public function that the container uses to pass in values for the labels
function public_Labels(label1, label2, label3, label4, label5, label6, label7){
t1.innerText = label1;
t2.innerText = label2;
t3.innerText = label3;
t4.innerText = label4;
t5.innerText = label5;
t6.innerText = label6;
t7.innerText = label7;
}
//a public function that the container uses to pass in values for the card containers
function public_Contents(contents1, contents2, contents3, contents4, contents5, contents6, contents7){
t1Contents.innerHTML = contents1;
t2Contents.innerHTML = contents2;
t3Contents.innerHTML = contents3;
t4Contents.innerHTML = contents4;
t5Contents.innerHTML = contents5;
t6Contents.innerHTML = contents6;
t7Contents.innerHTML = contents7;
init();
}
//sets the default display to tab 1
function init(){
tabContents.innerHTML = t1Contents.innerHTML;
}
//this is the tab switching function
var currentTab;
var tabBase;
var firstTag = true;
function changeTabs(){
if(firstTag == true){
currentTab = t1;
tabBase = t1base;
firstTag = false;
}
if(window.event.srcElement.className == "tab"){
currentTab.className = "tab";
tabBase.style.backgroundColor = "white";
currentTab = window.event.srcElement;
tabBaseID = currentTab.id + "base";
tabContentID = currentTab.id + "Contents";
tabBase = document.all(tabBaseID);
tabContent = document.all(tabContentID);
currentTab.className = "selTab";
tabBase.style.backgroundColor = "";
tabContents.innerHTML = tabContent.innerHTML;
}
}
</SCRIPT>
</head>
<BODY onclick="changeTabs()" onload="init()">
<div style="left: 25px;position: absolute;top: 20px;">
<table border="0" cellspacing="0" cellpadding="0" style="width: 304px;height: 26px;">
<tr>
<td width="76" height="26" style="cursor: hand;"><img src="images/billedertab.gif" width="76" height="26" align="bottom" alt="" class="selTab" id="t1"></td>
<td width="76" height="26" style="cursor: hand;"><img src="images/filmtab.gif" width="76" height="26" align="bottom" alt="" class="tab" id="t2"></td>
<td width="76" height="26" style="cursor: hand;"><img src="images/sangetab.gif" width="76" height="26" align="bottom" alt="" class="tab" id="t3"></td>
<td width="76" height="26" style="cursor: hand;"><img src="images/diversetab.gif" width="76" height="26" align="bottom" alt="" class="tab" id="t4"></td>
</tr>
<tr>
<td id="t1base" style="height: 2px;"></td>
<td id="t2base" style="height: 2px;"></td>
<td id="t3base" style="height: 2px;"></td>
<td id="t4base" style="height: 2px;"></td>
</tr>
</table></div><br><br>
<div style="position: absolute;top: 70px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="7" width="100%" height="*" id="tabContents"></td>
</tr>
</table>
</div>
<div id="t1Contents" class="conts">Tekst til link 1</div>
<div id="t2Contents" class="conts">Tekst til link2</div>
<div id="t3Contents" class="conts">Tekst til link3</div>
<div id="t4Contents" class="conts">Tekst til link4</div>
