web 开发之js---js 实现自动添加input text 编辑框

<html>
<head>
<script type="text/javascript">
function addNewLine()
{
var form=document.getElementById('form2');
var formTemp=document.createElement('form');
form.appendChild(formTemp);
var input=document.createElement('input');
var del=document.createElement('input');
del.type='button';
del.value='delete';
del.onclick=function(){form.removeChild(formTemp)}
formTemp.appendChild(input);
formTemp.appendChild(del);
}
</script>
</head>
<body>


<form id='form1'>
<input type="button" value="addNew" onclick='addNewLine()' />
</form>
<form id='form2'>
</form>


</body>
</html>

http://alzhai.com/post-374.html text input

http://www.jb51.net/article/17591.htm table

http://blog.sina.com.cn/s/blog_778ad6130100ye00.html table

posted @ 2014-12-15 17:12  midu  阅读(501)  评论(0编辑  收藏  举报