새 Region.html 파일을 만듭니다.
코드는 다음과 같습니다.
<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <h1 align="center">PHP+Ajax+Mysql省市县三级联动</h1> <table align="center" border="1" cellpadding="3" cellspacing="0" width="30%"> <tr bgcolor="skyblue"> <th>省份</th> <th>市</th> <th>县</th> </tr> <tr style="height: 100px"> <th> <select id="provinces"> <option value="">请选择省份</option> </select> </th> <th> <select id="citys"> <option value="">请选择市</option> </select> </th> <th> <select id="countys"> <option value="">请选择县</option> </select><br> </th> </tr> </table> <h4> <div align="center" id="region"></div></th> </h4> </body> </html>
다음과 같이 실행합니다.
다음 섹션