<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()">
动态创建表格
<html>
<head>
<title>Sample code - Traversing an HTML Table with JavaScript and DOM Interfaces</title>
<script>
function start() {
// get the reference for the body
var mybody = document.getElementsByTagName("body")[0];
// creates a <table> element and a <tbody> element
mytable = document.createElement("table");
mytablebody = document.createElement("tbody");
// creating all cells
for(var j = 0; j < 2; j++) {
// creates a <tr> element
mycurrent_row = document.createElement("tr");
for(var i = 0; i < 2; i++) {
// creates a <td> element
mycurrent_cell = document.createElement("td");
// creates a text node
currenttext = document.createTextNode("cell is row "+j+", column "+i);
// appends the text node we created into the cell <td>
mycurrent_cell.appendChild(currenttext);
// appends the cell <td> into the row <tr>
mycurrent_row.appendChild(mycurrent_cell);
}
// appends the row <tr> into <tbody>
mytablebody.appendChild(mycurrent_row);
}
// appends <tbody> into <table>
mytable.appendChild(mytablebody);
// appends <table> into <body>
mybody.appendChild(mytable);
// sets the border attribute of mytable to 2;
mytable.setAttribute("border", "2");
}
</script>
</head>
<body onload="start()">
</body>
</html>
分享到:
相关推荐
主要介绍了vue+element创建动态的form表单及动态生成表格的行和列 ,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
基于jQuery和layui的form表单自定义js动态生成
itextsharp文件外加在网上下的一个制作表格的案例 第一部分 iText的简单应用 第一章 创建一个Document 第一步 创建一个Document实例: 第二步 创建Writer实例 第三步 打开Document ...第十二章 页面和表格事件
动态表单生成 ... template中,form和form-item的写法和绑定 data里的值为空 methods中,向后台获取数据的函数写法 1. form,form-item,input的写法[^code] <el-form-item :key=domain.prop :lab
形式创造 form-create是一个表单生成组件,可以通过JSON生成动态呈现,数据收集,验证和提交功能。 支持3个UI框架,并支持生成任何Vue组件。 内置20种常用的表单组件和自定义组件,无论如何轻松地处理复杂的表单。...
主要介绍了angular学习之动态创建表单的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
创建和动态添加tabs组件 创建自动播放tab 创建XP风格左侧面板 数据表格 转换table到数据表格 数据表格添加分页组件 数据表格添加查询功能 数据表格添加工具条 数据表格设置冻结列 动态改变数据...
生成表格并将其包含在您的组件中: const Form = formGenerator(formConfig, components); ... <Form onSubmit={/*your submit function*/} /> 表格配置 formConfig是一个包含所有字段定义的对象。 让我们看...
vue-jsonschema-form [WIP:未准备好] 基于JSON模式表单生成器 概述 该项目的目的是创建一个简单的Vue组件,该组件能够根据构建HTML表单,并且默认情况下使用语义。 入门 克隆此存储库,安装依赖项并使用dev命令...
本文实例为大家分享了JS如何生成动态列表的具体代码,供大家参考,具体内容...创建动态表格</title> <style> #form1{ padding:10px; width:400px; margin:0 auto; } </style> <script type
验证表格(动态模型) 从数据库中的表单提交的存储数据 表单清单(GridView) 创建表单后创建数据库表 删除表单后删除数据库表 在将字段添加到表单后添加表列 更改字段名称后重命名表列 在表单中的删除字段之后...
Google Form动态PDF创建和电子邮件该Google脚本根据Google表单响应创建PDF,并附加到电子邮件和列出的收件人的电子邮件中。 此外,它还会在响应电子表格中插入一个ID列,并为覆盖面响应生成唯一的ID。 该脚本被设计...
您可以动态创建Google表单之类的表单。 此React代码可帮助您创建服务Google表单。 这种形式不只是附加html标签。 该表单创建数组,该数组使您想要的表单成为可能。 该数组可帮助您将此表单保存在数据库中。 安装 ...
第16章 应用表格和框架布局 16.1 使用表格进行网页设计和布局的方法 16.1.1 了解布局模块 16.1.2 表格布局的方法 16.2 在dreamweaver中使用表格 16.2.1 在“布局”模式下使用表格进行网页布局 16.2.2 在“布局”模式...
因此报表 程序是根据 一个或多个 数据库表格 的评估创建 报表的程序 。 在下列主题 中,您将学 习 选择数据 用逻辑数据库访问数据库表 使用选择屏幕 使用变体预设置选择 ABAP/4 事件概念 通过事件控制 ABAP/...
为表格添加序号,不支持动态表格。 Live clock.mxp Download 点击下载 为我们插入一个动态的时钟。 Kaosweaver PHP Upload.mxp Download 点击下载 把图片上传到你的网站。 PHP Date and time.mxp Download 点击...
mxp/使一个多行的表格行和行之间颜色交替,像斑马线一样。2.0版本 mxp/可以倒出-倒入站点信息,方便其他开发者 mxp/插入e-Vue MPEG-4格式的文件 mxp/Mycomputer.com提供的一套Banner交换系统,使用起来需要注册,...
查询功能也是系统的核心之一,在系 统中即有单条件查询和多条件查询,也有精确查询和模糊查询,系统不仅有静态的条件 查询,也有动态生成的条件查询,其目的都是为了方便用户使用。系统有完整的用户添 加、删除和...