ajax处理表单函数(序列化函数)
来源:互联网 发布:拼音读法软件 编辑:程序博客网 时间:2024/06/02 21:07
function serialize(form){ var parts = [], field = null, i, len, j, optLen, option, optValue; for (i=0, len=form.elements.length; i < len; i++){ field = form.elements[i]; switch(field.type){ case "select-one": case "select-multiple": if (field.name.length){ for (j=0, optLen = field.options.length; j < optLen; j++){ option = field.options[j]; if (option.selected){ optValue = ""; if (option.hasAttribute){ optValue = (option.hasAttribute("value") ? option.value : option.text); } else { optValue = (option.attributes["value"].specified ? option.value : option.text); } //parts.push(encodeURIComponent(field.name) + "=" + encodeURIComponent(optValue));parts.push(field.name + "=" + optValue); } } } break; case undefined: //fieldset case "file": //file input case "submit": //submit button case "reset": //reset button //case "button": //custom button break; case "radio": //radio button case "checkbox": //checkbox if (!field.checked){ break; } /* falls through */ default: //don't include form fields without names if (field.name.length){ // parts.push(encodeURIComponent(field.name) + "=" + encodeURIComponent(field.value)); parts.push(field.name + "=" + field.value); } } } return parts.join("&"); }
www.cpan.cc
- ajax处理表单函数(序列化函数)
- jQuery ajax序列化表单数据 serialize() serializeArray()函数的使用
- Ajax序列化表单
- ajax表单序列化
- Jquery 重写序列化函数提交表单
- python 序列处理函数
- python序列处理函数
- jQuery ajax 中级(getScript() ; getJSON() ;ajax; 表单序列化)
- Jquery ajax序列化表单
- 一个AJAX处理函数
- 简洁Ajax函数处理
- jQuery.ajax $.post $.load 序列化表单(ajax提交表单,post传递参数,序列化表单)
- 纯js实现的serialize函数,序列化表单数据
- form表单的序列化及serialize()函数的使用
- jQuery的ajax学习(一)表单序列化
- jQuery的ajax学习(一)表单序列化
- 4.10Python序列处理函数
- asp.net(ajax)表单验证 函数包
- 一个上海程序员的一天工作日志
- 黑马程序员_JAVA_银行业务学习笔记
- 聚集索引和非聚集索引
- 无法打开预编译头文件的解决方法及预编译头原理
- 黑马程序员-java基础学习03-面向对象基础
- ajax处理表单函数(序列化函数)
- 通向架构师的道路(第二天)之apache tomcat https应用
- Ubuntu实践(4):安装wxPython
- github使用
- 汉诺塔问题。
- 软件缺陷的由来 - 思考中。。。
- 哥德巴赫猜想。
- 使用cuda+opengl图形互操作性实现MPR
- 如何插入新浪微博&QQ代码到页面