1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Add input</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function addInput(f) {
var aInputs=f.getElementsByTagName('input');
for(var i=0; i<aInputs.length; i++) {
if(aInputs[i].className=='hide') {
aInputs[i].className='';
break;
}
}
}
</script>
<style type="text/css">
input {display:block;}
.hide {display:none;}
</style>
</head>
<body>
<form action="#" name="form1">
<div>
<input type="text" name="txt1">
<input class="hide" type="text" name="txt2">
<input class="hide" type="text" name="txt3">
<input class="hide" type="text" name="txt4">
<input class="hide" type="text" name="txt5">
<button type="button" onclick="addInput(this.form);">Add</button>
</div>
</form>
</body>
</html> |