I have a text box, and a select box with choices that are the same as the columns in a table. I want to be able to type in the box, select a column, press a button, and have it copy whatever is in the box, to every box in the column. I am having a hard time with the syntax as using a variable is the only thing that prevents this from working. When I put in real values, it works fine.
function testScript(fill) {
choice=document.form1.column.value;
alert (fill);
alert (choice);
for($i=0;$i<fill;$i++){
document.form1.choice[$i].value=document.form1.copy.value;
}
}
Fill (tested by the alert) provides me with the number of rows in the table and works fine. Choice is my select (drop down) box. If I type in “document.form1.make[$1].value= it fills what I type in every row of the make column. If I choose make in the select box, choice does say make as indicated by my test alert.
Any ideas how to use the variable correctly in the for loop?
Updated
view sample here:
jsfiddle link