<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>rui</title> <script type="text/javascript" src="resources/js/comm/jquery-1.8.0.min.js"></script> <script type="text/javascript"> $(function() { getAreas("P", "#areaOne"); }) function openTwo(code) { getAreas(code.value, "#areaTwo"); } function openThree(code) { getAreas(code.value, "#areaThree"); } //通过等级获取了菜单 function getAreas(level, seleId) { $.ajax({ url : "/baseClicent/base/getAreas", type : "POST", dataType : "json", data : { code : level }, success : function(returnData, status) { if (status = "success") { var data = returnData.data; //alert(JSON.stringify(data)) var html = '<option value="">请选择:</option>'; for (var i = 0; i < data.length; i++) { html += '<option value="'+data[i].code+'" >' + data[i].name + '</option>'; } $(seleId).html(html); } } }); } </script> </head> <body> <select onchange="openTwo(this)" id="areaOne"> </select> <select onchange="openThree(this)" id="areaTwo"> <option>请选择</option> <option>请选择</option> </select> <select id="areaThree"> <option>请选择</option> <option>请选择</option> </select> </body> </html>
原文地址:http://blog.csdn.net/liangrui1988/article/details/41895671