<div>
<select id="s_province" name="s_province" errmsg="请选择省"></select>
<select id="s_city" name="s_city" errmsg="请选择市"></select>
<select id="s_county" name="s_county" errmsg="请选择区"></select><br/>
<hr style="border-top:0px;border-left:none;border-right:none;border-bottom:none;"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/area.js"></script>
<script type="text/javascript">_init_area();</script>
<input type="text" name="alladd" id="alladd" value="${wxWeixiuyuan.wxAddress.wxAddressDetailed}" placeholder="详细地址..."style="width:355px;"/>
</div>
<div id="show"></div>
</div>
var addressProvince = ''; var addressCity = ''; var addressDistrict = ''; <c:if test="${wxWeixiuyuan.wxAddress!=null}"> addressProvince="${wxWeixiuyuan.wxAddress.wxAddressProvince}" ; addressCity="${wxWeixiuyuan.wxAddress.wxAddressCity}" ; addressDistrict="${wxWeixiuyuan.wxAddress.wxAddressDistrict}" ; </c:if> selectAddressOption($("#s_province"), addressProvince); selectAddressOption($("#s_city"), addressCity); selectAddressOption($("#s_county"), addressDistrict); function selectAddressOption(selectObject, selectName) { $(selectObject).find('option').each(function(i){ var isFind = false; if (isFind) return; if ($(this).text() == selectName) { isFind = true; $(this).attr('selected', true); $(selectObject).change(); return; } }); }