Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I place a dynamicly generated text box in a specific row?

Status
Not open for further replies.

Linnq

Programmer
Oct 24, 2003
13
CA
I have a function dynamicly generating text boxes and would like to place the boxes in a specific row of a table.
 
Use DOM to get the correct row...

Easiest if row has id..


Please show me what you have and I can show you...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
I've tried a few things but haven't had any luck, thanks for the quick response.

<script language=&quot;JavaScript&quot;>
//instantiate a global variable to hold the # of added controls
var numberOfAddedControls = 0;
function addTextBox(){
// increment number of added controls
numberOfAddedControls += 1;
var newBox = document.createElement(&quot;<input type='text' name='tbox&quot; + numberOfAddedControls + &quot;'>&quot;);
var newBreak = document.createElement(&quot;<br>&quot;);
document.body.insertBefore(newBox);
document.body.insertBefore(newBreak);
// check the name of added control
//alert(newBox.name);

//position textbox
//var formbox = document.getElementById('form1');
//formbox.appendChild(document.createElement('br'));
}
</script>
 
<script language=&quot;JavaScript&quot;>
//instantiate a global variable to hold the # of added controls
var numberOfAddedControls = 0;
function addTextBox(){
// increment number of added controls
numberOfAddedControls ++
newTD = document.createElement(&quot;td&quot;)
newInput = document.createElement(&quot;input&quot;)
newInput.name = &quot;tBox&quot; + numberOfAddedControls
newTD.parentNode.appendChild(newTD)
newTD.innerHTML = &quot;Label for input #&quot; + numberOfAddedControls
newTD.appendChild(newInput)
}
</script>

<table id=tableNode>
<tr id=rowNode>
<td id=cellNode>cell 1</td>
</tr>
</table>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top