C
ChronoFish
Hello,
I have some Javascript that adds rows to a table. This is
encapsulated in a function called "addVariable".
If I call the function while the page is loading, like this:
<script>
addVariable('group', 'new_1', 'empty');
addVariable('group', 'new_2', '');
</script>
The desired results occur. When I call the function via a button press
(onclick), the table row is not added, even though the function is
called (verified with an alert) and with the correct parameters are
being
passed.
The function that adds the row is here:
function addVariable(group, count, value)
{
alert(group+ ', ' + count + "= '" + value + "'");
var newRow = document.createElement('tr');
var rowId = group+'_row_'+count;
newRow.setAttribute('id',rowId);
newRow.innerHTML = '<td>' +
'<input id='+group+'attribute['+count+']
name='+group
+'attribute['+count+'] value=\''+value+'\'>' +
'<input type="button" value="x"
onclick="removeVariable(\''+rowId
+'\');">' +
'</td>';
document.getElementById("insert_"+group).appendChild(newRow);
}
The problem occurs in IE 7.0.5730.11 (only IE version tested).
Of course this works fine in Firefox.
Any suggestions?
Thanks,
CF
I have some Javascript that adds rows to a table. This is
encapsulated in a function called "addVariable".
If I call the function while the page is loading, like this:
<script>
addVariable('group', 'new_1', 'empty');
addVariable('group', 'new_2', '');
</script>
The desired results occur. When I call the function via a button press
(onclick), the table row is not added, even though the function is
called (verified with an alert) and with the correct parameters are
being
passed.
The function that adds the row is here:
function addVariable(group, count, value)
{
alert(group+ ', ' + count + "= '" + value + "'");
var newRow = document.createElement('tr');
var rowId = group+'_row_'+count;
newRow.setAttribute('id',rowId);
newRow.innerHTML = '<td>' +
'<input id='+group+'attribute['+count+']
name='+group
+'attribute['+count+'] value=\''+value+'\'>' +
'<input type="button" value="x"
onclick="removeVariable(\''+rowId
+'\');">' +
'</td>';
document.getElementById("insert_"+group).appendChild(newRow);
}
The problem occurs in IE 7.0.5730.11 (only IE version tested).
Of course this works fine in Firefox.
Any suggestions?
Thanks,
CF