标签:log 单选框 blog div var 联动 this html style
<select name="province" id="province" onchange="changeProvince(this.value)"> <option value="" selected>省/直辖市</option> <c:forEach items="${provinces }" var="province"> <option value="${province.code }" <c:if test="${buyer.province == province.code }">selected="selected"</c:if>>${province.name }</option> </c:forEach> </select>
function changeProvince(code){ //change to city var url = "/buyer/city.shtml"; var params = {"code" : code}; $.post(url,params,function(data){ var citys = data.citys; var html = ‘<option value="" selected>城市</option>‘;// for(var i=0;i<citys.length;i++){ html += ‘<option value="‘ + citys[i].code + ‘" >‘ + citys[i].name + ‘</option>‘; } $("#city").html(html); $("#town").html(‘<option value="" selected>县/区</option>‘); },"json"); }
function addProfile(){ var province = $("#province :selected").text(); var province = $("#province").find("option:selected").text(); //复选框定位 $("input[name=‘statusAddr‘]").attr("checked",true); //单选框定位 $("input[name=‘gender‘]").each(function(data){ var v = $(this).val(); if(v == "MAN"){ $(this).attr("checked",true); } }); var v = $("input[name=‘gender‘]:checked").val(); }
标签:log 单选框 blog div var 联动 this html style
原文地址:http://www.cnblogs.com/52hadoop/p/6849995.html