Expand Collapse Script Woes

D

David Jubinville

I can't seem to get this script working properly. Everything seems to be in
working order, but it's just not doing what I want - loading the window with
all <span> tags display:none. At this point, when you load the page all
spans are auto expanded until a point that you click on any single one.

<html>
<head>
<script type="text/javascript">

var iframeids=["frame"]

IdsForIE5 = new Array ()

SubIds = new Array ()

nums = new Array (0)

function Open(Sub) {
for (var i=0;i<SubIds.length;i++) {
a = document.getElementById(SubIds).style
if (SubIds == Sub) {
if (a.display == 'block') {
a.display = 'none'
} else {
a.display = 'block'
}
} else {
a.display = 'none'
}
}
}

IE5 =(parseInt(navigator.appVersion) == 4 &&
navigator.userAgent.toLowerCase().indexOf('msie 5.0') != -1);

onload = function() {
while (nums.length < 50) {
nums[nums.length] = nums.length + 1
}
for (var i=0;i<nums.length;i++) {
if (document.getElementById('sub-' + nums)) {
SubIds[SubIds.length] = 'sub-' + nums
}
if (document.getElementById('open-' + nums)) {
IdsForIE5[IdsForIE5.length] = 'open-' + nums
}
}
if (IE5) {
for (var i=0;i<IdsForIE5.length;i++) {
document.getElementById(IdsForIE5).style.cursor = 'hand'
}
}
if (document.getElementById('flag')) {
str = document.getElementById('flag').innerHTML
SubId = 'sub-' + str.slice(str.indexOf('flag-')+5,str.indexOf('-menu'))
if (document.getElementById(SubId)) {
Open(SubId)
}
}
}

</script>
</head>
<body>

<div id="content">
<div id="sectionHead">Expand Collapse</div>
<hr />
<div id="list"> <span id="open-1" onmousedown="return Open('sub-1')"
onmouseover="this.style.background='#FFCD00'; this.style.color='#333333'"
onmouseout="this.style.background='#F4F2F4'; this.style.color='#D41239'">
<img src="images/navsystem/expand.gif" />&nbsp;DSTB Tuner
Issues</span><br />
<br />
<div id="sub-1">
<iframe id="frame" src="data/cable/cable_dstb.html" scrolling="no"
marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0"
style="overflow:hidden; width:95%; display:none; border-bottom-style:solid;
border-bottom-color:#666666; border-bottom-width:thin;"></iframe>
<br />
</div>
</div>
</body>
</html>
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top