用javascript动态创建并提交表单form,表格table
<script>
//helper function to create the form
function getNewSubmitForm(){
var submitForm = document.createElement("FORM");
document.body.appendChild(submitForm);
submitForm.method = "POST";
return submitForm;
}
//helper function to add elements to the form
function createNewFormElement(inputForm, elementName, elementValue){
var newElement = document.createElement("<input name='"+elementName+"' type='hidden'>");
inputForm.appendChild(newElement);
newElement.value = elementValue;
return newElement;
}
//function that creates the form, adds some elements
//and then submits it
function createFormAndSubmit(){
var submitForm = getNewSubmitForm();
createNewFormElement(submitForm, "field1", "somevalue");
createNewFormElement(submitForm, "field2", "somevalue");
submitForm.action= "someURL";
submitForm.submit();
}
</script>
<input type="button" value="Click to create form and submit" onclick="createFormAndSubmit()">
http://blog.csdn.net/honey_claire/article/details/7658490
http://bbs.csdn.net/topics/300212131
http://bbs.csdn.net/topics/390693892
http://www.aa25.cn/code/458.shtml
最新文章
- vs增加第三方依赖库的方法总结
- dpkg
- JPEG格式
- 初识C++的类
- java从0开始学——数组,一维和多维
- Java 容器在实际项目开发中应用
- 构建Maven父子工程
- python之路——25
- GitLab CI with docker and dind ";mount: permission denied (are you root?)";
- 通过 rufus 创建启动U盘,安装 VMWare Esxi
- C#应用jstree实现无限级节点的方法
- HDMI之(AVI)Auxiliary Video Information InfoFrame
- Tarjan&;&;缩点简析
- PHP5.3新特性
- ubuntu13.04更新源
- 简单JS旋转实现转盘抽奖效果
- hdu 1599 find the mincost route (最小环与floyd算法)
- ORM进阶之Hibernate 的三大对象
- 笔记-cookie参数
- JZOJ 5455. 【NOIP2017提高A组冲刺11.6】拆网线
热门文章
- Ubuntu下不重装系统安装SSD总结
- jquery 监听input输入值事件
- WideCharToMultiByte和MultiByteToWideChar函数的用法
- 用Navicat Premium 远程连接oracle数据库
- CSS3之绽放的花朵(网页效果--每日一更)
- 使用curl 下载HTML
- .NET跨平台实践:用C#开发Linux守护进程
- Hadoop笔记
- RCP: JDT 根据org.eclipse.jdt.core.IJavaElement对象获取org.eclipse.jdt.core.dom.ASTNode对象
- Python黑客编程基础3网络数据监听和过滤