I have been trying to get this code to work and I can't figure out why it
doesn't.
I have a table that looks like this
<table width="100%" border="1" cellpadding="0" cellspacing="2"
id="linkedTable">
<tbody>
<tr><td class="content">1) </td>
<td><input type="text" name="linked_form[]" id="linked_form1"
onKeyUp="addInputField('linkedTable', 'linked_form', '1', '90')" size="90"></td>
</tr>
</tbody>
</table>
My script is like this
var fieldNum = 0;
function addInputField(tagID, fieldName, num, length) {
var newNum = 1+parseInt(num);
var funcText = "addInputField('" + tagID + "','" + fieldName + "','" +
newNum + "','" + length + "')"
alert(funcText)
if (document.getElementById(fieldName+num).value != '') {
row = document.createElement('TR');
cell = document.createElement('TD');
cell2 = document.createElement('TD');
txt = document.createTextNode(newNum + ') ');
field_input = document.createElement('INPUT');
field_input.setAttribute("type", 'text');
field_input.setAttribute("name", fieldName+"[]");
field_input.setAttribute("id", fieldName + newNum);
field_input.setAttribute("size", length);
field_input.setAttribute("onKeyUp", funcText);
field_input.setAttribute("onBlur", "cellHiliteOff()");
if (fieldNum != num) {
document.getElementById(tagID).appendChild(row);
row.appendChild(cell);
cell.appendChild(txt);
row.appendChild(cell2);
cell2.appendChild(field_input);
}
fieldNum = num;
}
}
In short it's supposed to add another row and two TD sells. One with text,
the other a form element.
The form element is a text field with the name linked_form[] (for use with
PHP), and an ID of linked_form1. The ID is incremented each time the function
is ran and a new input field is created. In other words, if there is a value
in the text field another is created so the user can use it if they want.
There is not limit to how many are created.
I had this exact script working before, but not where the javascript created
the row and cells. Instead it was all in one div tag. This time I want it in
a table to make the text in cell 1 to be even with the field in cell 2.
This all works fine in FireFox, but IE stops after creating the first new
field. From there IE does nothing and gives no errors.
Any suggestions?
Thanks in advance for the help.