Jump to content

menu problem


gerkintrigg

Recommended Posts

http://www.jewellerybasket.com/index.php

For some reason, if i have a sub-category it drops down, and if there is a category which has no sub-categories, it acts as a link. this is what I want, but after the non-subcategory link, all other drop-downs stop working and I'm not sure why

 

So to clarify, the link acts like a line which says "any drop-down above me is okay, but below me is not"

 

Any help would be appreciated.

 

Here's the code that I think is causing the problem:

while($r=mysql_fetch_array($sql)){
		$id=$r['id'];
		// print out the categories:

		# if it contains sub categories:
		$countsql=$qcount="SELECT * FROM `categories` WHERE `parent_category`='$id'";
$sqlcount=mysql_query($qcount);
$num=mysql_num_rows($sqlcount);
if ($num=='0'){
	$class='left_menu_link';
	$href='href="'.$root.'categories/'.$id.'"';
}
else{
	$class='menuitem submenuheader';
	$href='';
}

?>
<a <?php echo $href;?> class="<?php echo $class;?>"><?php 
if ($cat_txt=strstr($r['category'], '*')){
	$cat_txt=explode('*', $r['category']);
	$cat_txt=$cat_txt[1];
} else{
	$cat_txt=$r['category'];
}
echo $cat_txt;?></a>

Link to comment
https://forums.phpfreaks.com/topic/163384-menu-problem/
Share on other sites

because as soon as javascript encounters an error.. it will try and stop javascript from running properly for whatever reason..

 

in whatever your onMouseOver function is

put

 

try {

  // all your code here from the function

} catch (e) {

}

 

 

and when it hits an error, it will go to the catch and not throw an error.. coz when theres no subcategories it hits an error somewhere, so putting it in a try catch statement should solve ur problems

Link to comment
https://forums.phpfreaks.com/topic/163384-menu-problem/#findComment-862087
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.