• js


    静态页面

    <head runat="server">
        <title></title>
        <script src="jquery-1.4.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function changeCity() {
                var c = $("#Select1").val();
                var bei = $("#Select2");
                var tian = $("#Select3");
                if (c == "1") {
                    bei.show();
                    tian.hide();
                }
                if (c == "2") {
                    bei.hide();
                    tian.show();
                }
            }
        </script>
    </head>
    <body onload="changeCity();">
        <form id="form1" runat="server">
        <div>
                城市:<select id="Select1" onchange="changeCity();">
                <option value="1">北京</option>
                <option value="2">天津</option>
            </select>
            城区:
            <select id="Select2">
                <option value="1">朝阳区</option>
                <option value="2">海淀区</option>
            </select>
            <select id="Select3" >
                <option value="1">和平区</option>
                <option value="2">塘沽区</option>
            </select>
        </div>
        </form>
    </body>

    -----------------------------------------------------------------------------

    支持后台数据

    <head runat="server">
        <title></title>
        <script src="jquery-1.4.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function get() {
                var dataParamter = "city=" + $("#city").val(); ;
                $.ajax({
                    type: "POST",
                    dataType: "xml",
                    url: "Cityaaaa.ashx",
                    data: dataParamter,
                    success: function (data) {
                        var qu = $("#sel_b"); var op = "";
                        var nodeList = $("node", data);
                        if (nodeList.length > 0) {

                            nodeList.each(function (i) {
                                var nodeID = $(this).children("ID").text();
                                var typeName = $(this).children("name").text();
                                op += "<option value='" + nodeID + "'>" + typeName + "</option>";
                            });
                        }
                        qu.html(op);
                    }
                });

            }
        </script>
    </head>
    <body onload="get();">
        <form id="form1" runat="server">
        <div>
            城市:<select id="city" onchange="get();">
                <option value="1">北京</option>
                <option value="2">天津</option>
            </select>
            城区:
            <select id="sel_b">
            </select>
            <br />
            ------------------------------------------------------------------------------
            <br />

        </div>
        </form>
    </body>

     public class Cityaaaa : IHttpHandler
        {

            public void ProcessRequest(HttpContext context)
            {
                StringBuilder returnStr = new StringBuilder("<nodes>");

                if (!string.IsNullOrEmpty(context.Request["city"]))
                {
                    int level;
                    if (int.TryParse(context.Request["city"], out level))
                    {
                        if (string.IsNullOrEmpty(context.Request["city"]) == false)
                        {
                            int type;
                            if (int.TryParse(context.Request["city"], out type))
                            {
                                IList<City> codeTypeList = this.GetData(type);
                                if (codeTypeList != null && codeTypeList.Count > 0)
                                {
                                    string listStr = GetCodeType(codeTypeList);
                                    if (string.IsNullOrEmpty(listStr) == false)
                                    {
                                        returnStr.Append(listStr);
                                    }
                                }
                            }
                        }
                    }
                }
                returnStr.Append("</nodes>");
                context.Response.ContentType = "text/xml";
                context.Response.Write(returnStr.ToString());
            }

            //组建代码扩展信息XML节点串
            private string GetCodeType(IList<City> typeList)
            {
                StringBuilder codeSb = new StringBuilder();
                if (typeList != null && typeList.Count > 0)
                {
                    foreach (City code in typeList)
                    {
                        codeSb.Append("<node>");
                        codeSb.Append("<ID>" + code.ID + "</ID>");
                        codeSb.Append("<name>" + code.Name + "</name>");
                        codeSb.Append("</node>");
                    }
                }
                return codeSb.ToString();
            }

            private IList<City> GetData(int flag)
            {
                IList<City> list = new List<City>();
                switch (flag)
                {
                    case 1:
                        list.Add(new City() { ID = 1, Name = "东城区" });
                        list.Add(new City() { ID = 2, Name = "xi城区" });
                        list.Add(new City() { ID = 3, Name = "bei城区" });
                        list.Add(new City() { ID = 4, Name = "nan城区" });
                        break;
                    case 2:
                        list.Add(new City() { ID = 1, Name = "111" });
                        list.Add(new City() { ID = 2, Name = "xi222城区" });
                        list.Add(new City() { ID = 3, Name = "bei3333城区" });
                        list.Add(new City() { ID = 4, Name = "nan4444城区" });
                        break;
                    default:
                        break;
                }
                return list;
            }

            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }

    。cs文件中的

  • 相关阅读:
    esriFeatureType与esriGeometryType的区别与联系
    AO创建IFeature的两种方法
    ArcEngine查询、添加、删除要素的方法
    AE CreateFeatureClass 创建shp. 删除shp. 向shp中添加要素
    21OGNL与ValueStack(VS)-静态方法访问
    20.OGNL与ValueStack(VS)-普通方法访问
    19.OGNL与ValueStack(VS)-OGNL入门
    18.OGNL与ValueStack(VS)-值栈入门
    17.在Action获取Scope对象
    15.Result配置详解
  • 原文地址:https://www.cnblogs.com/lovehappy/p/2169360.html
Copyright © 2020-2023  润新知