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:
    <script language="javascript">
    var ie4 = false; if(document.all) { ie4 = true; }
    function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
    function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId);
    if (lText == 'TV shows & movies') { link.innerHTML = 'TV shows & movies!'; d.style.display = 'block'; }
    else { link.innerHTML = 'TV shows & movies'; d.style.display = 'none'; } }
    </script>
    PHP:
    in the link
    <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>
    
    movies</td></tr><tr><td>
    Full metal alchemist</td></tr><tr><td>
    Futurama</td></tr><tr><td>
    Stargate</td></tr><tr><td>
    The melancholy of haruhi suzumiya</td></tr><tr><td>
    Band of brothers</td></tr></table></div>
    <script language="javascript">toggle(getObject('exp1167767950_link'), 'exp1167767950');</script>
    PHP:
    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
    
    <td class="navigation"><strong>
    <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>
    
    movies</td></tr><tr><td>
    Full metal alchemist</td></tr><tr><td>
    Futurama</td></tr><tr><td>
    Stargate</td></tr><tr><td>
    The melancholy of haruhi suzumiya</td></tr><tr><td>
    Band of brothers</td></tr></table></div>
    <script language="javascript">toggle(getObject('exp1167767950_link'), 'exp1167767950');</script></td>
    
    Code (markup):
    with

    
    <td class="navigation"><strong>
    <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>
    
    movies</td></tr><tr><td>
    Full metal alchemist</td></tr><tr><td>
    Futurama</td></tr><tr><td>
    Stargate</td></tr><tr><td>
    The melancholy of haruhi suzumiya</td></tr><tr><td>
    Band of brothers</td></tr></table></div>
    </td>
    
    Code (markup):
     
    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