0

hi guys..is there a problem with my code? because, i am trying to add a row dynamically depending on the user requirements, what the code does is that, whenever the image is clicked, only the textbox appears, what should happen is that the textbox should be inside the row..

<head>
<script language="javascript">
function addRow(tableID) 
{ 
	var table = document.getElementById(tableID); 
	var rowCount = table.rows.length;
	var row = table.insertRow(rowCount);   
		
	var cella = row.insertCell(0);
	var element1 = document.createElement("input");
	element1.type = "text";
	element1.name = "txtManufacturer[]";
	element1.size = "10";
	cella.appendChild(element1);	
}
</script>
</head>
<table id="myDiv" width=100% cellpadding="5" cellspacing="1" >
  <tr>
    <td width="97" align="center" bgcolor="#CCCCCC">Manufacturer</td>
  </tr>
  <tr>
    <td class="R11Black" align="left" bgcolor="#EAEAEA" valign="top"><input type="text" name="txtManufacturer" id="txtManufacturer" size="10" /></td>
    
  </tr>
</table>
<p><span class="R11Black"><img align=absmiddle src="images/plus.jpg" onclick="addRow('myDiv')" style="cursor: pointer" height="20" width="20"></span> Add another item</p>
Attachments Image10.png 2.18 KB
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by itisnot_me
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.