<div class="codetitle"> <span><a style="CURSOR: pointer" data="25768" class="copybut" id="copybut25768" onclick="doCopy('code25768')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code25768"> <br> <br> <br><title>jquery xml解析</title> <br><script src="jquery.min.js" type="text/javascript"></script> <br><script type="text/javascript"> <BR>$(document).ready(function(){ <BR>$.ajax({url:"City.xml", <BR>success:function(xml){ <BR>$(xml).find( "province").each(function(){ <BR>var t = $(this).attr("name");//this-> <BR>$("#DropProvince").append("< ;option>" t ""); <BR>}); <BR>} <BR>}); <BR>$("#DropProvince").change(function(){ <BR> $("#sCity>option").remove(); <BR>var pname = $("#DropProvince").val() <BR>$.ajax({url:"City.xml", <BR>success:function(xml){ <BR>$(xml).find("province[name='" pname "']>city").each(function(){ <BR>$("#sCity" ).append("<option>" $(this).text() "") <BR>} <BR>}); 🎜>}); <BR></script> <br> <br> <br><form id="form1"> <br><div> <br><select id="DropProvince" style="width:60px;"> <br><option>请选择</option> <br></select> <br><select id="sCity" style="width:60px;"> <br></select> <br> </div> <br> </form> <br> <br> </div>