All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
.net仿照51job网站地区选择效果_[Asp.Net教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/1/30 1:16:05 Browse times: 321 Comment times: 0

.net仿照51job网站地区选择效果_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

.net仿照51job网站地区选择效果_[Asp.Net教程]

















效果图: .net仿照51job网站地区选择效果

难点: 定位,其实不难, 取得父元素(省)的位置,然后设置 市(初始隐藏)的位置 = 父元素位置偏移n个px
id为pop 的div是模式窗口
说一下流程吧
1.ajax读出所有省市
2.市放在一个div里面,初始是隐藏的,然后给每一个省加一个onclick事件,控制这个省的市显示还是隐藏
3.完成。
说得简单了点,不过看代码就看明白了!有不明白可以在这里留言,我会关注!
html代码




















<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="test_Default" %>





无标题页



















position: absolute; top: 172px; height: 350px; background-color: #faffeb; z-index:99999">




请选择地区
[关闭]
[不限]


























后台输出代码




















private void Bind()
{
IList listP = bllP.DataTableToList(bllP.GetAllList().Tables[0]);
string arr = string.Empty;
string ct = string.Empty;
for (int i = 0; i < listP.Count; i++)
{
IList listC = bllC.DataTableToList(bllC.GetList("provinceid=’" + listP[i].ProvinceID + "’").Tables[0]);

arr += "";

ct += "

    ";
    for (int j = 0; j < listC.Count; j++)
    {
    if (listC.Count > 0)
    {
    if (listC[j].ProvinceID == listP[i].ProvinceID)
    {
    if (j == 0)
    {
    ct += listP[i].ProvinceName + "
    ";
    }
    ct += "
  • " + listC[j].CityName + "
  • ";
    }
    }
    }
    ct += "


";
arr += ct;

}

Response.Write(arr);
Response.End();
}










































There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.