demonforce Posted September 3, 2007 Share Posted September 3, 2007 hi i have a small, but irritating problem. i have a database with all kind of news in it, and i want it to show the newwest 3 id's in a collapse menu. i allready have the collapse script, and the php part, but cause some reason it wont work. code: COLLAPSE <script type="text/javascript"> function switchMenu(obj) { var el = document.getElementById(obj); if ( el.style.display != "none" ) { el.style.display = 'none'; } else { el.style.display = ''; } } </script> STYLE <style type="text/css"> <!-- body { text-align:center; margin:30px; } #wrapper { text-align:left; margin:0 auto; width:150px; min-height:10px; border:1px solid #ccc; padding:10px; } a { color:blue; cursor:pointer; } #id1 { border:1px solid #ccc; background:#f2f2f2; padding:20px; } --> </style> PHP <?php require("mysql.connect.php"); $query = @mysql_query("SELECT * FROM nieuws") or die(mysql_error()); while($values = mysql_fetch_array($query)) { $id = $values['id']; $naam = $values['naam']; $bericht = $values['bericht']; echo "<div id='wrapper'>"; echo "<a onclick='switchMenu('id1');' title='naam'>naam</a>"; echo "<div id='id1'>bericht</div>"; echo "</div>"; } ?> what do i do wrong? Quote Link to comment https://forums.phpfreaks.com/topic/67827-using-javascript-in-php/ Share on other sites More sharing options...
pocobueno1388 Posted September 3, 2007 Share Posted September 3, 2007 You would get much more help in the javascript forum. Quote Link to comment https://forums.phpfreaks.com/topic/67827-using-javascript-in-php/#findComment-340971 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.