复制代码代码如下:
<! 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 </itlem>
<script type = "text/javaScript">
// 创建节点
var additems = function () {
document.getElementById ("div1"). innerhtml = "" ؛
var value = parseint (document.getElementById ('headsnumber'). value) ؛
لـ (var i = 0 ؛ i <value ؛ i ++) {
var input = document.createElement ("input") ؛
input.setAttribute ("type" ، "text") ؛
var br = document.createElement ("br") ؛
document.getElementById ("div1"). appendChild (input) ؛
document.getElementById ("div1"). appendChild (BR) ؛
}
}
</script>
</head>
<body>
<type type = "text" id = "headsnumber">
<type type = "button" id = "btn" value = "click" onClick = "addItems () ؛" >
<div id = "div1"> </viv>
</body>
</html>