1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

looking for help with javascript expanding box

Discussion in 'JavaScript' started by pig2cat, Feb 23, 2007.

  1. #1
    heya
    http://piggymoo.com/index2.php
    on my site i have an expandable box at the tv shows & movies in the navigation
    but in internet explorer it expands it when loading the page, but it should just expand if you click the link (like it does fine in firefox now)
    in header code:
    PHP:
    1. <script language="javascript">
    2. var ie4 = false; if(document.all) { ie4 = true; }
    3. function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
    4. function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId);
    5. if (lText == 'TV shows & movies') { link.innerHTML = 'TV shows & movies!'; d.style.display = 'block'; }
    6. else { link.innerHTML = 'TV shows & movies'; d.style.display = 'none'; } }
    7. </script>
    in the link
    PHP:
    1. <a title="show/hide" id="exp1167767950_link" href="java script: void(0);" onclick="toggle(this, 'exp1167767950');"> TV shows & movies</a> </strong> </td><td><div id="exp1167767950" style="padding: 3px;"><table><tr><td>
    2.  
    3. movies</td></tr><tr><td>
    4. Full metal alchemist</td></tr><tr><td>
    5. Futurama</td></tr><tr><td>
    6. Stargate</td></tr><tr><td>
    7. The melancholy of haruhi suzumiya</td></tr><tr><td>
    8. Band of brothers</td></tr></table></div>
    9. <script language="javascript">toggle(getObject('exp1167767950_link'), 'exp1167767950');</script>
    looking for some help:(
     
    pig2cat, Feb 23, 2007 IP
  2. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Replace lines 80-89, ie
    Code (Text):
    1.  
    2. <td class="navigation"><strong>
    3. <a title="show/hide" id="exp1167767950_link" href="javascript: void(0);" onclick="toggle(this, 'exp1167767950');"> TV shows &amp; movies</a> </strong> </td><td><div id="exp1167767950" style="padding: 3px;"><table><tr><td>
    4.  
    5. movies</td></tr><tr><td>
    6. Full metal alchemist</td></tr><tr><td>
    7. Futurama</td></tr><tr><td>
    8. Stargate</td></tr><tr><td>
    9. The melancholy of haruhi suzumiya</td></tr><tr><td>
    10. Band of brothers</td></tr></table></div>
    11. <script language="javascript">toggle(getObject('exp1167767950_link'), 'exp1167767950');</script></td>
    12.  
    with

    Code (Text):
    1.  
    2. <td class="navigation"><strong>
    3. <a title="show/hide" id="exp1167767950_link" href="javascript: void(0);" onclick="toggle(this, 'exp1167767950');">TV shows &amp; movies</a> </strong> </td><td><div id="exp1167767950" style="padding: 3px;display:none;"><table><tr><td>
    4.  
    5. movies</td></tr><tr><td>
    6. Full metal alchemist</td></tr><tr><td>
    7. Futurama</td></tr><tr><td>
    8. Stargate</td></tr><tr><td>
    9. The melancholy of haruhi suzumiya</td></tr><tr><td>
    10. Band of brothers</td></tr></table></div>
    11. </td>
    12.  
     
    Aragorn, Feb 24, 2007 IP
    pig2cat likes this.
  3. pig2cat

    pig2cat Active Member

    Messages:
    299
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #3
    yay it works!
    thanks man!
    +rep for you:)
     
    pig2cat, Feb 24, 2007 IP
  4. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Thanx for the reps :)
     
    Aragorn, Feb 24, 2007 IP