用javascript动态添加和删除文本框
2008-09-01 17:35
471 查看
用javascript动态添加和删除文本框
<script language="javascript">
function add()
{
option = new Array();
proportion = new Array();
str='<table>';
strstr=str+'<tr align=center valign=middle bgcolor=#FFFFFF>';
strstr=str+'<td width="100%" height="25"><input type="text" name=proportion></td>';
strstr=str+'<td width="100%" height="25"><input type="button" name=del onclick="this.parentNode.parentNode.parentNode.deleteRow(this.parentNode.parentNode.rowIndex)" value="删除"></td>';
strstr=str+'</tr></table>';
window.upid.innerHTML+=str+'';
}
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form name="myform" onsubmit="javascript:return check()">
<table>
<tr>
<td>
<input name="Submit2" type="button" onclick="javascript:add()" value="增加">
</td>
</tr>
<tr>
<td>
<div id="upid"></div>
</td>
</tr>
</table>
</form>
</body>
</html>
<script language="javascript">
function add()
{
option = new Array();
proportion = new Array();
str='<table>';
strstr=str+'<tr align=center valign=middle bgcolor=#FFFFFF>';
strstr=str+'<td width="100%" height="25"><input type="text" name=proportion></td>';
strstr=str+'<td width="100%" height="25"><input type="button" name=del onclick="this.parentNode.parentNode.parentNode.deleteRow(this.parentNode.parentNode.rowIndex)" value="删除"></td>';
strstr=str+'</tr></table>';
window.upid.innerHTML+=str+'';
}
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form name="myform" onsubmit="javascript:return check()">
<table>
<tr>
<td>
<input name="Submit2" type="button" onclick="javascript:add()" value="增加">
</td>
</tr>
<tr>
<td>
<div id="upid"></div>
</td>
</tr>
</table>
</form>
</body>
</html>
相关文章推荐
- 用javascript动态添加删除文本框(轉自:http://www.diybl.com/course/1_web/javascript/jsjs/200838/103423.html)
- 用javascript动态添加删除文本框
- jQuery + JavaScript 实现的动态添加文本框功能 和 动态删除文本框功能(二)
- javascript实现动态添加和删除文件上传选项
- 使用JavaScript动态添加、 删除表格
- javascript;select动态添加和删除option
- JavaScript动态添加文本框
- JavaScript动态操作表格,添加,删除行、列及单元格
- 用Javascript动态添加和删除表格行(1)说明和举例
- 用Javascript动态添加删除HTML元素实例 (转载)
- JavaScript动态操作表格(添加,删除行、列及单元格)
- JavaScript(jQuery)动态添加/删除html列表
- JavaScript动态添加删除表格行(支持FireFox)
- COM动态添加删除成员,类似JavaScript中调用的对象
- javascript操作table的动态添加行和删除行
- 使用javascript动态添加和删除table的行和列
- javascript里面的数组,json对象,动态添加,修改,删除示例
- JavaScript动态操作表格实例(添加,删除行,列及单元格)
- javascript动态添加、修改、删除对象的属性和方法
- 用Javascript动态添加和删除表格行(2)源代码