2个回答
推荐于2018-04-11
展开全部
jquery chosen 多个级联,参考例子如下:
text.html页面源码:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>三级联动例子</title>
<link href="../css/chosen.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/jquery-1.8.2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../js/carinforesolve.js" charset="utf-8"></script>
<script type="text/javascript" src="../js/chosen.jquery.js" charset="utf-8"></script>
<SCRIPT type=text/javascript>
$(document).ready(function () {
var dom = new carInfoResolve("swapCarBrand", "swapCarSeries", "swapCarSpec");
dom.init();
});
</SCRIPT>
</head>
<body>
<select id="swapCarBrand" name="swapCarBrand" class="selectCar" >
</select>
<select id="swapCarSeries" name="swapCarSeries" class="selectCar" >
</select>
<select id="swapCarSpec" name="swapCarSpec" class="selectCar" >
</select>
</body>
</html>
三个xml配置文件如下:
第一级文件carBrand.xml
<?xml version="1.0" encoding="utf-8"?>
<carBrands>
<carBrand ID="1">A 奥迪</carBrand>
<carBrand ID="2">B 宝马</carBrand>
</carBrands>
第二级文件carSeries.xml<?xml version="1.0" encoding="utf-8"?>
<carSeriess>
<carSeries ID="1" PID="1">奥迪A3</carSeries>
<carSeries ID="2" PID="1">奥迪Q3</carSeries>
<carSeries ID="3" PID="2">宝马5系</carSeries>
<carSeries ID="4" PID="2">宝马3系</carSeries>
</carSeriess>
第三级文件carSpec.xml
<?xml version="1.0" encoding="utf-8"?>
<carSpecs>
<carSpec ID="1" PID="1">2014款 35豪华型</carSpec>
<carSpec ID="2" PID="1">2014款 35舒适型</carSpec>
<carSpec ID="3" PID="1">2014款 35时尚型</carSpec>
</carSpecs>
text.html页面源码:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>三级联动例子</title>
<link href="../css/chosen.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/jquery-1.8.2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../js/carinforesolve.js" charset="utf-8"></script>
<script type="text/javascript" src="../js/chosen.jquery.js" charset="utf-8"></script>
<SCRIPT type=text/javascript>
$(document).ready(function () {
var dom = new carInfoResolve("swapCarBrand", "swapCarSeries", "swapCarSpec");
dom.init();
});
</SCRIPT>
</head>
<body>
<select id="swapCarBrand" name="swapCarBrand" class="selectCar" >
</select>
<select id="swapCarSeries" name="swapCarSeries" class="selectCar" >
</select>
<select id="swapCarSpec" name="swapCarSpec" class="selectCar" >
</select>
</body>
</html>
三个xml配置文件如下:
第一级文件carBrand.xml
<?xml version="1.0" encoding="utf-8"?>
<carBrands>
<carBrand ID="1">A 奥迪</carBrand>
<carBrand ID="2">B 宝马</carBrand>
</carBrands>
第二级文件carSeries.xml<?xml version="1.0" encoding="utf-8"?>
<carSeriess>
<carSeries ID="1" PID="1">奥迪A3</carSeries>
<carSeries ID="2" PID="1">奥迪Q3</carSeries>
<carSeries ID="3" PID="2">宝马5系</carSeries>
<carSeries ID="4" PID="2">宝马3系</carSeries>
</carSeriess>
第三级文件carSpec.xml
<?xml version="1.0" encoding="utf-8"?>
<carSpecs>
<carSpec ID="1" PID="1">2014款 35豪华型</carSpec>
<carSpec ID="2" PID="1">2014款 35舒适型</carSpec>
<carSpec ID="3" PID="1">2014款 35时尚型</carSpec>
</carSpecs>
推荐于2016-03-18
展开全部
给你写了个例子
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询