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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.