ajax php mysql无限级联菜单 联动菜单 二级联动 三级联动菜单
ajax php mysql无限级联菜单 联动菜单 二级联动 三级联动菜单
无限级联菜单 联动菜单 二级联动 三级联动菜单
有几个级别的菜单就显示级别
本例是《ajax php 动态读取的级联菜单 联动菜单》的扩展,由二级联动扩展到无限级
XML/HTML Code
- <div id="show_sub_categories">
- <select name="search_category" class="parent">
- <option value="" selected="selected">-- Categories --</option>
- <?php
- $query = "select * from ajax_categories where pid = 0";
- $results = mysql_query($query);
- while ($rows = mysql_fetch_assoc(@$results))
- {?>
- <option value="<?php echo $rows['id'];?>"><?php echo $rows['category'];?></option>
- <?php
- }?>
- </select>
- </div>
JavaScript Code
- <script type="text/javascript">
- $(document).ready(function() {
- //$('#loader').hide();
- $('.parent').livequery('change', function() {
- $(this).nextAll('.parent').remove();
- $(this).nextAll('label').remove();
- $('#show_sub_categories').append('<img src="loader.gif" style="float:left; margin-top:7px;" id="loader" alt="" />');
- $.post("get_chid_categories.php", {
- parent_id: $(this).val(),
- }, function(response){
- setTimeout("finishAjax('show_sub_categories', '"+escape(response)+"')", 400);
- });
- return false;
- });
- });
- function finishAjax(id, response){
- $('#loader').remove();
- $('#'+id).append(unescape(response));
- }
- </script>
相关推荐
周公周金桥 2020-09-06
大象从不倒下 2020-07-31
AlisaClass 2020-07-19
MaureenChen 2020-04-21
xingguanghai 2020-03-13
teresalxm 2020-02-18
木四小哥 2013-05-14
SoShellon 2013-06-01
Simagle 2013-05-31
羽化大刀Chrome 2013-05-31
waterv 2020-01-08
LutosX 2013-07-29
vanturman 2013-06-27
wutongyuq 2013-04-12
luoqu 2013-04-10
ChinaWin 2020-08-13
kangtingting0 2020-05-20
MichelinMessi 2020-02-19