惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Register - Security
The Register - Security
云风的 BLOG
云风的 BLOG
U
Unit 42
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Docker
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Secure Thoughts
Hacker News: Ask HN
Hacker News: Ask HN
Vercel News
Vercel News
S
Security @ Cisco Blogs
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
I
Intezer
MongoDB | Blog
MongoDB | Blog
AI
AI
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
博客园 - 叶小钗
S
SegmentFault 最新的问题
N
News | PayPal Newsroom
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
H
Help Net Security
美团技术团队
博客园 - 司徒正美
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
Kaspersky official blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Vulnerabilities – Threatpost
TaoSecurity Blog
TaoSecurity Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity
J
Java Code Geeks
量子位
Martin Fowler
Martin Fowler
博客园_首页

博客园 - 天天无用

jsonp原理实例及mvc中的应用 ubuntu笔记 修复MVC3中使用Remote验证的一点小问题 诺基亚手机S60系统证书申请、软件签名图文教程 JAXER留言板-一个html页面的ajax留言版 - 天天无用 - 博客园 初探JAXER Jquery插件研究:Ajax File Upload 本月wii游戏太多,感觉有点堕落 使用jQuery加DIV实现可以动态添加的金字塔结构 Asp.net 2.0 TreeView控件使用jQuery无刷新添加节点详细说明 用jQuery实现.net 2.0 treeview客户端无刷新操作的实例 基于jQuery的AJAX和JSON实现纯html数据模板 自己写的DataTable转换成JSON字符串的函数 自己写的jQuery自动完成的插件(AutoComplete) asp.net treeview控件无刷新选择和删除节点(使用jquery) - 天天无用 - 博客园 纵向合并gridview单元格的两种方法 .net下两种json序列化速度比对 asp.net 2.0 中 TreeView控件中的checkbox客户端操作 asp.net 2.0中根据roles显示不同的sitemap - 天天无用 - 博客园
自制的操作下拉列表框(SELECT)的三个jquery插件(ajax填充、联动、增加选项) - 天天无用 - 博客园
天天无用 · 2007-11-14 · via 博客园 - 天天无用

    首先是ajax填充插件FillOptions,这个插件可以通过ajax方法获取数据并把数据添加到下拉列表框,数据格式支持xml格式和json格式,插件定义如下
        FillOptions(url,options)
    参数说明
        url:ajax请求的地址,必须 options包括如下参数
        datatype:ajax请求返回的数据格式,可以是"xml”或"json”,默认为"json”
        textfield:ajax请求返回的数据中下拉列表框选项文本的字段,默认为"text”
        valuefiled:ajax请求返回的数据中下拉列表框选项值的字段,默认为"value”
        keepold:布尔类型,是否保留下拉列表框选项原有选项,默认为不保留
        selected:数值型,填充选项后第几项为选中状态,默认为0
    实例如下:

    $("#Select1").FillOptions("handler1.ashx?type=json",{datatype:"json",textfield:"province",valuefiled:"provinceID"});

     实例说明:Select1是页面上一个下拉列表框,通过访问"handler1.ashx?type=json"这个地址,返回“[{"provinceID":"110000","province":"北京市"},{"provinceID":"120000","province":"天津市"}]”这样格式的数据,然后通过指定的textfield和valuefiled参数,生成下拉列表框的option并添加到Select1。更多例子可以看下载中的test.htm
    下拉列表框联动插件CascadingSelect,这个插件是基于上面FillOptions插件制作的,可以实现两个下拉列表框的联动,定义如下:
        CascadingSelect(target,url,options,endfn)
    参数说明:
        target:需要联动的下拉列表框,必须
        url:ajax请求的地址,必须 options与FillOptions的类似,增加了一个参数
        parameter:ajax请求时传回值的参数名,必须
        endfn:类型是function,完成联动后执行
    实例如下:

            $("#Select1").CascadingSelect(
                            $(
"#Select2"),
                                  
"handler1.ashx?type=json",
                            
{datatype:"json",textfield:"city",valuefiled:"cityID",parameter:"p"},
                            
function(){
                                       $(
"#Select2").AddOption("请选择","-1",true,0);
                                $(
"#Select3").html("");
                                        $(
"#Select3").AddOption("无选项","-1",true,0);
                            }

            );

    实例说明:Select1,Select2,Select3都是页面上的下拉列表框,通过设置parameter:”p”这个参数会生成一个"handler1.ashx?p=xxx&type=json”这样的地址来做ajax请求,xxx为select1所选择的值,返回后使用FillOptions来填充Select2的option。具体实例请看test1.htm中实现的省市区的三级联动。
    添加一个列表项的插件AddOption,这个比较简单,用来向下拉列表框中添加一个列表项。定义如下:
        AddOption (text,value,selected,index)
    参数说明:
        text:文本型,列表项文本
        value:文本型,列表项值
        selected:布尔型,是否选择加入的列表项 index:数值型,加入位置
    实例如下: 

$("#Select2").AddOption("请选择","-1",true,0);

    实例说明:向select2最上端插入一个文本为“请选择“,值为”-1“的列表项,并且是选中状态
    下载地址http://bbs.jquery.org.cn/viewthread.php?tid=637&extra=page%3D1或者是http://download.csdn.net/user/luq885