zac1987 Posted December 2, 2008 Share Posted December 2, 2008 Currently my this menu can only show but cannot hide. when I click on a category, it shows a list of items. When I click again the category, the list of items must hide back. How is the code to hide back the list of items? Could anyone help me? Thanks. I am newbie in PHP, so please show me the code in more detail. Thanks. Below is the coding. Hope someone can help me modify it so that when I click 2nd time the category, it will hide the items. click 3rd time, it will show items. click 4th time, it will hide... function public_navigation($sel_category, $sel_item){ $output = "<div style=\"overflow:auto; height:435px; width:250px;\" name=\"content\" ><ul class=\"categories\">"; $category_set = get_all_categories(); while ($category = mysql_fetch_array($category_set)) { $output .= "<li"; if ($category["id"] == $sel_category['id']){ $output .= " class=\"selected\""; } $output .= "><a href=\"index.php?category=" . urlencode($category["id"]) . "\">{$category["category"]}</a></li>"; if ($category["id"] == $sel_category['id'] || $category["id"] == $sel_item['category_id']){ $item_set = get_items_for_categories($category["id"]); $output .= "<ul class=\"items\">"; while ($item = mysql_fetch_array($item_set)) { $output .= "<li"; if ($item["id"] == $sel_item['id']){$output .= " class=\"selected\"";} $output .= "><a href=\"index.php?item=" . urlencode($item["id"]) . "\">{$item["item"]}</a></li>"; } $output .= "</ul>"; } } $output .= "</ul></div>"; return $output; } Link to comment https://forums.phpfreaks.com/topic/135123-can-anyone-help-me-to-make-my-menu-able-to-hideshow-thanks-a-lot/ Share on other sites More sharing options...
waynew Posted December 2, 2008 Share Posted December 2, 2008 This is a JavaScript issue. Link to comment https://forums.phpfreaks.com/topic/135123-can-anyone-help-me-to-make-my-menu-able-to-hideshow-thanks-a-lot/#findComment-703800 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.