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>

this should be posted in the javascript forum. not php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.