
September 4th, 2004
11:14 PM
Neverside Newbie
Status: Offline!
Creating input boxes on the fly
Hi there,
How can I have a form with (drop down menu of values from 1 to 20) so if I select for example 5, then 5 input boxes will be created on the fly (each one under the other) of the same name but different indexes e.g. TextBox[1] TextBox[2] etc...
I hope I was clear 
Thanx alot in advance.

September 4th, 2004
11:57 PM
Neverside Newbie
Status: Offline!
I think it's like:
if (document.FORMNAME.SELECTBOXNAME.value == SELECTEDVALUE)
{
document.write("<input type='text'>");
}
Something like that... but maybe it won't work. I think it's better to pre-load the boxes and display them instead:
if (document.FORMNAME.SELECTBOXNAME.value == SELECTEDVALUE)
{
document.FORMNAME.INPUTNAME.style.display = 'block';
}
___________________
Learn HTML

September 5th, 2004
07:23 AM
now with more lambda
Status: Offline!
Function that creates input boxes:
// n = number of inout boxes
// myForm is the form element to append the boxes to
function createInputs(n, myForm){
for(var i=0; i<n; i++){
myForm.appendChild(document.createElement('input'));
}
}
___________________
