复制代码代码如下:
<! doctype html public "-// w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<title> jQuery2 </title>
<script type = "text/javascript">
// 创建节点
var addItems = function () {
document.getElementById ("div1"). innerhtml = "";
var value = parseInt (document.getElementById ('itemnumber'). ค่า);
สำหรับ (var i = 0; i <value; i ++) {
var input = document.createElement ("input");
input.setAttribute ("type", "text");
var br = document.createElement ("br");
document.getElementById ("div1"). ภาคผนวก (อินพุต);
document.getElementById ("div1"). AppendChild (BR);
-
-
</script>
</head>
<body>
<อินพุต type = "text" id = "itemnumber">
<อินพุต type = "ปุ่ม" id = "btn" value = "คลิก" onclick = "addItems ();" -
<div id = "div1"> </div>
</body>
</html>