点击最初的下拉菜单选择板块内容~然后读取数据库获取下级分类,然后jq输出分类的下级菜单~并且绑定同一个事件,修改后也许就可以应用到你们项目中;用jquery写的,第一次分享,觉得不好的请轻喷~~
js代码如下: $(".js_type").live('change',function(){<br>
var _this=$(this);<br>
var _this_id=_this.attr('id');<br>
var url='<!--{:U("Lib/ajaxType")}-->';<br>
var $v=_this.val();<br>
_this.nextAll("select").remove();<br>
switch(_this_id){<br>
case 'js_plateid':{<br>
var data='plateid='+$v;<br>
} break;<br>
case 'js_pid': var data='uid='+$v; break;<br>
};<br>
$('<span>',{'class':'loadPtype'}).insertAfter(_this);<br>
$('.loadPtype').text("加载中...");<br>
$.ajax({<br>
'url':url,<br>
'type':'POST',<br>
'data':data,<br>
'success':function(data){<br>
var obj=jQuery.parseJSON(data);<br>
var option='';<br>
if(obj!=null){<br>
switch(_this_id){<br>
case 'js_plateid':{<br>
var $new_select=$('<select>',{'class':'js_type','id':'js_pid'});<br>
};break;<br>
case 'js_pid':{<br>
var $new_select=$('<select>',{'name':'subtypeid'}); <br>
};break;<br>
}<br>
$new_select.insertAfter(_this);<br>
$('.loadPtype').remove();<br>
for(var i=0;i<obj.length></obj.length>
option+="<option>"+obj[i].typename+"</option>";<br>
}<br>
$new_select.html(option);<br>
}else{<br>
$(".loadPtype").text('无二级分类');<br>
} <br>
}<br>
});<br>
});</select></select></span>
html代码:
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!
