javascript实现二级级联菜单的简单制作

javascript实现二级级联菜单的简单制作

具体代码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <script type="text/javascript" src=""></script> <style type="text/css"> .body_tag{ width: 100%; height: 100%; } </style> <script type="text/javascript"> /** * */ function province() { var proName = $("#areaName").val(); $("#city").empty(); $("#city").append("<option value='0'>全部</option>"); if(proName == "1") { $("#city").append("<option value='1'>广州市</option>"+ "<option value='2'>深圳市</option>"+ "<option value='3'>中山市</option>"); } if(proName == "2") { $("#city").append("<option value='1'>武汉市</option>"+ "<option value='2'>黄石市</option>"+ "<option value='3'>黄冈市</option>"); } } </script> </head> <body> <table> <tr> <td> <label for="areaName">省份:</label> <select onchange="province()"> <option value="0">全国</option> <option value="1">广东</option> <option value="2">湖北</option> </select> <label for="city">地市:</label> <select> <option value="0">全部</option> </select> </td> </tr> </table> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgzjfy.html