HTML/Html-practice/Ajax/基于jQuery的AJAX实现三级联动菜单/index.html
2023-05-01 21:33:04 +08:00

43 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<link href="./css/index.css" rel="stylesheet" type="text/css"/>
<script src="./js/index.js"></script>
<title>基于jQuery的AJAX实现三级联动菜单</title>
</head>
<body>
<div>
<form>
省份:
<select name="province" id="province">
<option value="0">--请选择--</option>
</select>&nbsp;&nbsp; 城市:
<select name="city" id="city">
<option value="0">--请选择--</option>
</select>&nbsp;&nbsp; 地区:
<select name="area" id="area">
<option value="0">--请选择--</option>
</select>
</form>
</div>
</body>
<script>
$(function(){
getCountry();
$("#province").change(function(){
CountryId=$("#province").val();
// console.log(FatherId);
getCity(CountryId);
CityID=$("#city").val();
console.log(CityID);
getArea(CityID);
});
})
</script>
</html>