Darkmatter5 Posted March 25, 2009 Share Posted March 25, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/151127-help-toggling-divs-on-and-off/ Share on other sites More sharing options...
jackpf Posted March 26, 2009 Share Posted March 26, 2009 I do believe you have to encapsulate A1 and G1 within some sort of quotation. Quote Link to comment https://forums.phpfreaks.com/topic/151127-help-toggling-divs-on-and-off/#findComment-794774 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.