所以,我有三个文本框。第一个是要求名字,第二个是姓,第三个是年龄。单击按钮时会生成一个新的文本框? - Javascript
当我点击按钮时,应该生成第四个文本框,它应该包含到目前为止在每个文本框中输入的所有内容。我的问题是我甚至无法让第四个文本框出现。我觉得我错过了很简单的事情。这是我的代码到目前为止。
<html>
<head>
</head>
<body>
<script>
function addTextBox() {
var element = document.createElement("input");
element.setAttribute("type", "text");
element.setAttribute("value", "");
element.setAttribute("name", "Test Name");
}
</script>
<form>
<input type="text" value="Firstname">
<input type="text" value="Lastname">
<input type="text" value="Age">
<input type="button" onclick="addTextBox()">
</form>
</body>
</html>
我知道这将是一些简单。谢谢! (: – Lou 2015-04-01 04:45:22
@Lou标记为答案,如果上述解决您的查询 – 2015-04-01 04:46:09