SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    making div dissapear and re-appear

    EDIT
    =========

    Solved!
    Mod please delete

    =========


    Hi,

    I'm seriously stuck with a javascript prob I've been having!

    For my forum, I have a div:

    echo "<div id='panel$post_id' style='display: none'>";
    echo "</div>";

    The div has a unique name - panel and post_id (e.g. panel12345)


    then some javascript:

    <script language="javascript" type="text/javascript">
    function showpanel(txt) {

    if (txt.style.display == '') {
    txt.style.display = 'none';
    } else {
    txt.style.display == '';
    }

    }
    </script>

    The javascript checks if the div is shown/hidden. I use the following link to call the javascript:

    <a onclick="showpanel('panel<?php echo $post_id ?>');">Show/Hide Panel</a>


    It just doesn't work - I'm not sure what's wrong, but I think it's presuming txt is the name of the div, as opposed to the value of txt.

    Thanks in advance!

  2. #2
    SitePoint Enthusiast lucius910's Avatar
    Join Date
    Jul 2004
    Location
    Providence, RI
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •