Expand Collapse Script Woes

Discussion in 'Javascript' started by David Jubinville, Jan 12, 2005.

  1. 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>
     
    David Jubinville, Jan 12, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vaclav Jedlicka

    datagrid and border-collapse:collapse style

    Vaclav Jedlicka, Jun 26, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    6,015
    Yan-Hong Huang[MSFT]
    Jun 30, 2003
  2. VVSRKS

    How can I avoid border-collapse:collapse to come ...

    VVSRKS, Sep 16, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    219
    VVSRKS
    Sep 16, 2004
  3. Randy Starkey

    expand / collapse all with this script

    Randy Starkey, Aug 8, 2005, in forum: Javascript
    Replies:
    1
    Views:
    100
    Randy Starkey
    Aug 10, 2005
  4. Replies:
    0
    Views:
    165
  5. M.L.
    Replies:
    9
    Views:
    313
Loading...

Share This Page