1. 程式人生 > >動態新增刪除表格

動態新增刪除表格

<html>
<head>
<title>||Working with elements||</title>
</head>

<script type="text/javascript">




	function   showDiv(){  
        var div = document.createElement("div");
		div.innerHTML = "<input type=\"text\" value=\"\" name=\"username\"/><a href=\"\">刪除</a>";
		document.getElementById("org_div1").appendChild(div);
	  }
</script>

<body>
<div id='org_div1'> <a href="javascript:void(0)" onclick="showDiv();">新增.</a></div>
</body>
</html>