以下是json数据表:

[
{
"p" : "银川市",
"c" : [{"c1":"兴庆区"},{"c1":"金凤区"},{"c1":"西夏区"},{"c1":"中宁县"},{"c1":"灵武市"},{"c1":"贺兰县"}]
},
{
"p" : "石嘴山市",
"c" : [{"c1":"大武口区"},{"c1":"惠农区"},{"c1":"平罗县"}]
},
{
"p" : "吴忠市",
"c" : [{"c1":"利通区"},{"c1":"红寺堡区"},{"c1":"盐池县"},{"c1":"同心县"},{"c1":"青铜峡市"}]
},
{
"p" : "中卫市",
"c" : [{"c1":"沙坡头区"},{"c1":"中宁县"},{"c1":"海原县"}]
},
{
"p" : "固原市",
"c" : [{"c1":"原州区"},{"c1":"泾源县"},{"c1":"西吉县"},{"c1":"隆德县"},{"c1":"彭阳县"}]
}
]

html代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
<title>城市级联</title>
</head>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
#city,#country{
display: none;
}
#city div{
background-color: #666666;
color: #fff;
width: 30.3%;
margin:1.5% ;
float: left;
}
#country div{
background-color: #666666;
color: #fff;
width: 30.3%;
margin:1.5% ;
float: left;
}
#sheng{
display: none;
}
.cityclass{
background-color: #CCCCCC;
z-index: 100;
}
</style>
<body>
<input type="" name="dest" ).html(htmls);
$('#country').show();
}
$('#country').find('div').click(function(){
$('#dest').val(b+$(this).html());
$('#country').hide();
$('#dest').show();
})
}
});
});
})

})

</script>
</body>
</html>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案