输入地址信息 C#

来源:互联网 发布:3000块淘宝高佣金软件 编辑:程序博客网 时间:2024/06/05 13:23

引用 js

<script type="text/javascript" src="/resource/scripts/jquery/PCASClass.js"></script>
html文件 
<pre name="code" class="html"><pre name="code" class="html">      <dl>         <dt>地址</dt>             <dd>                    <select id="txtProvince" name="txtProvince" class="select"></select>                    <select id="txtCity" name="txtCity" class="select"></select>                    <select id="txtArea" name="txtArea" class="select"></select>                </dd>            </dl>
<pre name="code" class="html">  <span style="white-space:pre"></span><asp:HiddenField runat="server" ID="hidprovince"></asp:HiddenField>            <asp:HiddenField runat="server" ID="hidcity"></asp:HiddenField>            <asp:HiddenField runat="server" ID="hidarea"></asp:HiddenField>


js文件
<pre name="code" class="javascript"> $(function () {            new PCAS("txtProvince", "txtCity", "txtArea");            $("#txtProvince").change(function () {                onPCAChanged();            });            $("#txtCity").change(function () {                onPCAChanged();            });            $("#txtArea").change(function () {                onPCAChanged();            });            function onPCAChanged() {                var aValue = [$('#txtProvince option:selected').val(), $('#txtCity option:selected').val(), $('#txtArea option:selected').val()];                $("#HiddenField1").val(aValue.join(","));            }            $("#txtProvince").val($('#hidprovince').val()).change();            $("#txtCity").val($('#hidcity').val()).change();            $("#txtArea").val($('#hidarea').val());                          //初始化地址                $("#province").find("option[value='" + $('#hidprovince').val() + "']").attr("selected", true);                $("#city").append("<option value='" + $('#hidcity').val() + "']>" + $('#hidcity').val() + " </option>");                $("#city").find("option[value='" + $('#hidcity').val() + "']").attr("selected", true);                $("#area").append("<option value='" + $('#hidarea').val() + "'> " + $('#hidarea').val() + "</option>");                $("#area").find("option[value='" + $('#hidarea').val() + "']").attr("selected", true);            })








0 0
原创粉丝点击