Jump to content

Help toggling divs on and off


Darkmatter5

Recommended Posts

Here's the JavaScript

function helpcontents(divName) {
    document.getElementById(G1).style.display='none';
    document.getElementById(A1).style.display='none';
    document.getElementById(divName).style.display='block';
}

 

Here's the HTML/PHP

<span class="title_text">General Help Index</span>
  <ol>
  <li><a href="help.php" onclick="helpcontents('G1'); return false;">General site Introduction</a></li>
  </ol>
  <?php
    if(isset($_SESSION['member_id'])) {
      $member_id=$_SESSION['member_id'];
      $query=mysql_query("SELECT * FROM members WHERE member_id=$member_id") or die(mysql_error());
      $rights=mysql_fetch_array($query);
      if($rights['priv_admin']==1) {
        echo "<span class='title_text'>Administrative Help Index</span>
                <ol>
                <li><a href='help.php' onclick=\"helpcontents('A1'); return false;\">Admin introduction</a></li>
                </ol>";
      }
    }
  ?>
  <div id="G1" style="display: block;">General</div>
  <div id="A1" style="display: none;">Administrative</div>

Link to comment
https://forums.phpfreaks.com/topic/151127-help-toggling-divs-on-and-off/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.