Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Expand Collapse Script Woes

Reply
Thread Tools

Expand Collapse Script Woes

 
 
David Jubinville
Guest
Posts: n/a
 
      01-12-2005
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[i]).style
if (SubIds[i] == 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[i])) {
SubIds[SubIds.length] = 'sub-' + nums[i]
}
if (document.getElementById('open-' + nums[i])) {
IdsForIE5[IdsForIE5.length] = 'open-' + nums[i]
}
}
if (IE5) {
for (var i=0;i<IdsForIE5.length;i++) {
document.getElementById(IdsForIE5[i]).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>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expand/Collapse script expands but does not collapse M.L. Javascript 9 08-29-2007 08:49 PM
Perfect expand/collapse content script? m.p.petrov@gmail.com Javascript 0 01-26-2006 07:53 PM
expand / collapse all with this script Randy Starkey Javascript 1 08-10-2005 05:40 AM
How can I avoid border-collapse:collapse to come ... VVSRKS ASP .Net Datagrid Control 0 09-16-2004 10:13 AM
datagrid and border-collapse:collapse style Vaclav Jedlicka ASP .Net 1 06-30-2003 03:31 AM



Advertisments