| 0 comments ]

<body>
<head><TITLE>Test HTML DOM and JavaScript</TITLE>
<script language="javascript" type="text/javascript">
function addNewTexrFields() {
var ni = document.getElementById('testDiv');
var count = ni.childNodes.length;
if(count<4){
count=count+1;
var p = "addDiv"+i;

var testA = document.createElement('div');
testA.setAttribute('id',p);
testA.setAttribute('align','left');

var testTxt = document.createElement('input');
testTxt.setAttribute('type','text');
testTxt.setAttribute('name','test[]');
testTxt.setAttribute('size','40');

testA.appendChild(testTxt);
ni.appendChild(testA);
}
}
</script>
</head>
<body>
<table>
<tr>
<td align="left" width="40%">
text fields
</td>
<td align="left" width="60%">
<input type="text" size="40" name="test[]"> <a href="javascript:addNewTexrFields()">Add More</a>
<div align="left" id="testDiv"></div>
</td>
</tr>
</table>
</body>
</html>


just try it .........

0 comments

Post a Comment

Please put your comments here. your questions, your suggestions, also what went wrong with me.