Sublime directory Surf the web anonymous Pagerank Monitor


Drop-Down Menu

pbinns
Mon 18 February 2008, 05:20 am GMT +0100
I know very little about PHP and I'm wondering how to create a simple drop-down menu. I have a menu created using javascript but I was wondering if it's possible to create the same menu using PHP?
Maybe that's not what PHP is inteded for. Just curious. Thanks!

Here's the javascript menu...



<script type="text/javascript">
<!--
window.onload=show;
function show(id) {
var d = document.getElementById(id);
for (var i = 1; i<=10; i++) {
if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
}
if (d) {d.style.display='block';}
}
//-->
</script>

and the html....

<div class="menu1">
<span onmouseover="javascript:show('smenu1');">Menu 1</span><br />
<span class="submenutext" id="smenu1" onmouseover="javascript:show('smenu1');" onmouseout="javascript:show('');">
<a href="#">Sublink1.1</a><br />
<a href="#">Sublink1.2</a><br />
<a href="#">Sublink1.3</a><br />
<a href="#">Sublink1.4</a><br />
</span>
</div>

olaf
Mon 18 February 2008, 12:18 pm GMT +0100
Hi,

what do you need a dynaic menu based on some data from a database or just the javascript effect?

PHP doesn't has client effects like you have posted above

pbinns
Mon 18 February 2008, 05:40 pm GMT +0100
Really I just wanted the javascript effect. My thinking was, and I'm sure it's flawed, that if I could use php to make the drop-down menu then I wouldn't have to worry about all of the viewers who have javascript disabled in their web browser.
Am I going down the wrong path??

olaf
Mon 18 February 2008, 08:45 pm GMT +0100
Really I just wanted the javascript effect. My thinking was, and I'm sure it's flawed, that if I could use php to make the drop-down menu then I wouldn't have to worry about all of the viewers who have javascript disabled in their web browser.
Am I going down the wrong path??

yes :D

Javascript is executed in the users  browser and php on the server

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional