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

推荐订阅源

S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
Spread Privacy
Spread Privacy
Scott Helme
Scott Helme
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
量子位
Security Latest
Security Latest
P
Proofpoint News Feed
P
Privacy International News Feed
P
Palo Alto Networks Blog
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google Online Security Blog
Google Online Security Blog
Webroot Blog
Webroot Blog
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
Vercel News
Vercel News
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客
Hacker News - Newest:
Hacker News - Newest: "LLM"
K
Kaspersky official blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Stack Overflow Blog
Stack Overflow Blog
AWS News Blog
AWS News Blog
博客园 - Franky
爱范儿
爱范儿
T
Tor Project blog
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
小众软件
小众软件
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
W
WeLiveSecurity
SecWiki News
SecWiki News
L
LangChain Blog
I
InfoQ

博客园 - 自信飞扬

mac 10.8 编译提示找不到GCC .NET Framework 4.5 五个很棒的特性 easyui datagrid json 格式 IE打印 javascript 解析json javascript 函数toFixed 详读《.NET 设计规范》 javascript刷新验证码 关于打包winfrom 程序的注意事项 WCF协议 apache编译参数 asp.net中应用jquery + ashx的传值 - 自信飞扬 获取鼠标坐标 获取应用程序所在的物理路径 静止输入法切换的CSS 防止DIV被撑开的CSS asp.net ajax MSDN帮助 asp.net 角色管理 MSDN帮助路径 CSS设置DIV中写入字符自动换行 - 自信飞扬 - 博客园
javascript操作select和AjaxPro返回数组点滴
自信飞扬 · 2011-09-16 · via 博客园 - 自信飞扬

一:javascript操作select

var selectobj = document.getElementByID('select');
var selectedindex = selectobj.selectedIndex;
//设置选中
selectobj.option[i].selected = true;
//获取选中的option的value和text
var val = selectobj.options[selectedindex].value;
var text = selectobj.options[selectedindex].text;
//遍历option
for(var i=0;i<selectobj.options.length;i++)
{
    selectobj.options[i]........
}

 二:AjaxPro返回自定义对象列表

 1 /*
 2 *自定义对象一定要标明可以序列化
 3 *使用Serializable关键字声明
 4 */

   [Serializable]
 5 class SerClass{
 6     private string id;
 7     private string name;
 8     public string Id{
 9         getreturn id; }
10         set{ id = Value;}
11     }
12     public string Name{
13         getreturn name;}
14         set{ name = Value;}
15     }
16 }

后台方法:

 1 //普通操作仅仅声明[AjaxPro.AjaxMethod]即可
 2 //若要操作Seesion,则声明成[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
 3 
 4 [AjaxPro.AjaxMethod]
 5 public List<SerClass> QueryList(){
 6     List<SerClass> objlist = new List<SerClass>();
 7     SerClass obj = new SerClass();
 8     obj.ID = "";
 9     obj.Name = "";
10     objlist.Add(obj);
11     .........
12     return objlist;
13 }

客户端调用:

1 var result = 类名.QueryList();
2 if(result.error != null ){
3     alert(result.error.Message);
4     return false;
5 }
6 for(var i=0; i< result.length;i++){
7     result[i].ID;
8     result[i].Name;
9 }