<!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('itemsNumber').value);
for (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>
<input type="text" id="itemsNumber">
<input type="button" id="btn" value="click" onclick="addItems();" >
<div id="div1"></div>
</body>
</html>