I am making a dynamic vertical drop down menu. Is there anyone out there who can tell me whats wrong with this code.
[code=php]
<html>
<head>
<title>Drop down menu</title>
<style text=”text/css”>
.display_none {display: none; }
</style>
<script type=”text/javascript”>
function showProduct() {
var els=document.getElementsByName(arguments[0]);
for(var i=0,l=els.length;i<l;i++){
els[i].style.display = “block”;
}
}
function hideProduct() {
var els=document.getElementsByName(arguments[0]);
for(var i=0,l=els.length;i<l;i++){
els[i].style.display = “none”;
}
}
</script>
</head>
<body>
<?PHP
$category=mysql_query(“SELECT * from products order by category, product ASC”);
$cnum=mysql_num_rows($category);
echo mysql_error();
echo “<ul>n”;
$count=1;
while($a=mysql_fetch_array($category)) {
if($a[category] != $lastcategory) {
$label=substr($a[category], 0, 2);
echo “<li><a href=”#” onMouseOver=”showProduct(‘p_$label’);” onMouseOut=”hideProduct(‘p_$label’);”>$a[category]</a></li>n”;
$lastcategory=$a[category];
}
$label=substr($a[category], 0, 2);
echo “<ul name=”p_$label” class=”display_none”><li>$a[product]</li></ul>n”;
$count++;
}
echo “</ul>n”;
?>
</body>
</html>
Thanks,
matt
[url]www.maddDidley.com