How to handle ID's in series (myID01-myID50, otherID01-otherID50)

S

spazzwig

Hi, very new here. I had some help getting this far so I don't fully
understand the code below (I understand it as I read it, but not quite
enough that I could write it from scratch).
Thanks to Lasse in this group for helping me get this far.

Ok, here's what I have:

---
// Create an array of our tabs
var divArray = [];
function cacheDivs() {
var divs = document.getElementsByTagName("div");
for (var i=0;i<divs.length;i++) {
if (/^(tab\_overview|tab\_resources)/.test(divs.id)) {
divArray[divArray.length]=divs;
}
}
for (var i in divArray) {
divArray.style.display = (divArray.id ==
'tab_'+tabname)?'block':'none';
}
}

// Find which tabs are set to open
var openTab;
function initialize() {
openTab = document.getElementById('tab_overview01');
}
// need to change this so all 'overview' series tabs are open

// Function which actually swaps tabs
function changePopTab(tabname) {
openTab.style.display = 'none';
openTab = document.getElementById('tab_'+tabname);
openTab.style.display = 'block';
}
// need to change above so that just the selected ID and the "matching" ID
get swapped (tab_overview09 <-> tab_resources09)
---

---
<body onload="initialize();">

<misc content .... >

<div id="popup01" .... >
<some content... >
<div id="poptabs">
<div ... >
<a href="javascipt:;" onclick="changePopTab('overview01');return
false;">Overview</a> |
<a href="javascipt:;"
onclick="changePopTab('resources01');return false">Resources & Links</a>
</div>
<div id="tab_overview01" ... >
<content... >
</div>
<div id="tab_resources01" ... >
<content... >
</div>
</div>
</div>
<div id="popup02" ... >
< etc........

</body>
---

When the page loads, all 'tab_overviewXX' ID's are set as open. Then when
'changePopTab' is called the idea is just to switch the matching
'tab_overviewXX' with 'tab_resourcesXX' (i.e. tab_overview09 <-->
tab_resources09). So the tabs are to toggle information in a pop-up 'layer',
and there are several pop-up 'layers' in a page.

Hopefully this makes sense. I've learned a lot over the course of this, but
much of it is a bit over my head.

Thanks!
Gabe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,082
Messages
2,570,588
Members
47,209
Latest member
Ingeborg61

Latest Threads

Top