<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 .........
Showing posts with label adding new html elements using HTML DOM and JavaScript. Show all posts
Showing posts with label adding new html elements using HTML DOM and JavaScript. Show all posts
[Friday, November 02, 2007
|
0
comments
]
Popular Posts
- MYSQL joins
- function to check whether the year given is a leap year or not
- Elgg : The most popular open source social networking platform
- How to create a plugin in elgg.
- some php questions
- creating dynamic elements in HTML using Javascript.
- question regarding socket
- MYSQL UNION
- php question
- php Questions
