js中点击下拉框的问题

一中是两个下拉框都是通过一中的数组加入进去的我想要点击绿框的下拉选项然后在2中打开相应的界面如何添加js代码?跪等详细的js代码{非诚勿扰}!!!... 一中是两个下拉框 都是通过一中的数组加入进去的 我想要点击绿框的下拉选项 然后在2中打开相应的界面 如何添加js代码? 跪等详细的js代码 {非诚勿扰}!!! 展开
 我来答
zhangqi0192
推荐于2016-08-13 · TA获得超过2387个赞
知道大有可为答主
回答量:1417
采纳率:0%
帮助的人:1219万
展开全部
给你发个 省市 联动的例子 你看了就明白了
var shenArr=["请选择省份/城市","北京市","上海市","天津市","重庆市","香港特别行政区","澳门特别行政区","湖南","辽宁","河北","山东","河南","湖北","福建","四川","江西"];//自定义下标(属性)
//shenArr["名称"]
shenArr["请选择省份/城市"]=["请选择城市/地区"];
shenArr["北京市"]=["北京市"];
shenArr["上海市"]=["上海市"];
shenArr["天津市"]=["天津市"];
shenArr["重庆市"]=["重庆市"];
shenArr["香港特别行政区"]=["香港特别行政区"];
shenArr["澳门特别行政区"]=["澳门特别行政区"];
shenArr["福建"]=["福州市","厦门市","泉州市","漳州市","南平市","三明市","龙岩市","莆田市"];
shenArr["湖南"]=["长沙市","株洲市","湘潭市","郴州市","益阳市","娄底市","衡阳市","常德市"];
shenArr["辽宁"]=["沈阳市","大连市","抚顺市","鞍山市","铁岭市","本溪市","丹东市","锦州市"];
shenArr["河北"]=["保定市","唐山市","邯郸市","邢台市","沧州市","衡水市","廊坊市","承德市"];
shenArr["山东"]=["济南市","青岛市","威海市","潍坊市","菏泽市","济宁市","莱芜市","烟台市"];
shenArr["河南"]=["洛阳市","焦作市","商丘市","信阳市","周口市","鹤壁市","安阳市","濮阳市"];
shenArr["湖北"]=["武汉市","荆门市","汉口市","咸宁市","襄樊市","荆州市","黄石市","孝感市"];
shenArr["江西"]=["南昌市","赣州市","上饶市","宜春市","吉安市","抚州市","萍乡市","九江市"];
//市级下拉框绑定
$("select[name=sheng]").change(function(){
var index=$(this).val();
var shiArr=shenArr[index];
$("select[name=shi]").empty();
$.each(shiArr,function(i,val){
//添加下拉项
$("select[name=shi]").append("<option value='"+val+"'>"+val+"</option>");
});
});

html标签部分
<select name="sheng"></select> 
<select name="shi">
<option>请选择城市/地区</option>
</select>
你把省份改成第xxx次作业 然后把市改成 另外右边的这些内容
希望能帮到你 谢谢
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式