⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 citylist.aspx

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 ASPX
字号:
<%@ Page Language="C#" AutoEventWireup="true" Codebehind="CityList.aspx.cs" Inherits="PowerEasy.WebSite.Admin.Shop.CityList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>选择城市</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div style="width: 100%; text-align: center;">
        <table width="560px" border="0" cellpadding="2" cellspacing="0" style="margin:0 auto;" class="border">
            <tr class="title" style="height: 22">
                <td align="left">
                    <b>已经选定的城市:</b></td>
            </tr>
            <tr class="tdbg">
                <td align="left">
                    <input type="text" id="CityList" size="60" maxlength="200" readonly="readonly" class="inputtext" />
                    <input type="hidden" name="HdnCityName" id="HdnCityName" value="" />
                    <br />
                    <input type="button" class="inputbutton" name="Submit" onclick="javascript:window.close();"
                        value="确定" />
                    <input type="button" class="inputbutton" name="del1" onclick="del(1)" value="删除最后" />
                    <input type="button" class="inputbutton" name="del2" onclick="del(0)" value="删除全部" /></td>
            </tr>
        </table>
        <br />
        <table width="560px" border="0" cellpadding="2" cellspacing="0" class="border">
            <tr class="title">
                <td align="left">
                    <asp:DropDownList ID="DropProvince" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropProvince_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <asp:UpdatePanel runat="server" ID="UpnlProvince">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="DropProvince" EventName="SelectedIndexChanged" />
                        </Triggers>
                        <ContentTemplate>
                            <asp:DataList ID="DlstCity" runat="server" CssClass="tdbg" RepeatColumns="5" RepeatDirection="Horizontal"
                                Width="100%">
                                <ItemStyle HorizontalAlign="Center" Width="20%" />
                                <ItemTemplate>
                                    <a href="#" onclick="<%# "add('" + Eval("City") + "')"%>">
                                        <%#Eval("City")%>
                                    </a>
                                </ItemTemplate>
                            </asp:DataList>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
        </div>
    </form>
</body>
</html>

<script language="javascript" type="text/javascript">
    var inputControl = opener.document.getElementById('<%= inputControlId %>');
    var inputControl2 = opener.document.getElementById('<%= inputControlId2 %>');
    document.getElementById('CityList').value = inputControl.value;
    function add(obj)
    {
        if(obj==""){return false;}
        var DropProvince = document.getElementById("<%=DropProvince.ClientID%>");
        var DropProvince_Index = DropProvince.selectedIndex;
        var DropProvince_Value = DropProvince.options[DropProvince_Index].value;
        if(inputControl.value=="")
        {
            inputControl.value= DropProvince_Value  + "|" + obj;
            document.getElementById('CityList').value = inputControl.value;
            inputControl2.value = inputControl.value;
            return false;
        }
        var singleCityName=obj.split(",");
        var ignoreCityName="";
        for(i=0;i<singleCityName.length;i++)
        {
            if(checkCityName(inputControl.value,DropProvince_Value  + "|" + singleCityName[i]))
            {
                ignoreCityName=ignoreCityName+singleCityName[i]+" ";
            }
            else
            {
                inputControl.value = inputControl.value + "," + DropProvince_Value  + "|" + singleCityName[i];
                document.getElementById('CityList').value = inputControl.value;
                 inputControl2.value = inputControl.value;
            }
        }
        if(ignoreCityName!="")
        {
            alert(ignoreCityName+"此城市已经存在,此操作已经忽略!");
        }
    }
    
    function del(num)
    {
        if (num==0 || inputControl.value=="" || inputControl.value==",")
        {
            inputControl.value="";
            inputControl2.value="";
            document.getElementById('CityList').value="";
            return false;
        }
    
        var strDel=inputControl.value;
        var s=strDel.split(",");
        inputControl.value = strDel.substring(0,strDel.length-s[s.length-1].length-1);
        document.getElementById('CityList').value = inputControl.value;
        inputControl2.value = inputControl.value;
    }
    
    function checkCityName(CityNamelist,thisCityName)
    {
      if (CityNamelist==thisCityName){
            return true;
      }
      else{
        var s=CityNamelist.split(",");
        for (j=0;j<s.length;j++){
            if(s[j]==thisCityName)
                return true;
        }
        return false;
      }
    }
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -