代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Jquery1.7.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$.ajax({
type: "post",
contentType: "application/json",
url: "WebService1.asmx/loadprovince",
data: "{}",
success: function (result) {
var ping;
for (var i = 0; i < result.d.length; i++) {
ping += "<option value=" + result.d[i].provinceID + ">";
ping += result.d[i].provincename;
ping += "</option>";
}
$('#Select1').append(ping);
}
})
$('#Select1').change(function () {
//第二次选时要记得清空市和县中的内容
$('#Select2 option:gt(0)').remove();
$('#Select3 option:gt(0)').remove();
//在省的改变事件里绑定下一个下来列表(要失掉省的id)
新闻热点
疑难解答
图片精选