Am still fairly low on the Rails/Javascript learning curve, so pardon me
if i am missing something elementary--
Am trying to stick a new row at the end of a table in response to some
event.
My table looks like this:
<table id=''originStops'' class=''stops''>
<tr>
<td><strong>Origin Stops</strong> </td>
<td class="ListActions"><a href="#"
onclick="showPopWin(''/location/select'', 600, 450,
add_origin_link);;
return false;">Add</a></td>
</tr>
</table>
I want to add new row to this table.
My Prototype effort (pun, sort of), was to put in a div right before the
end of the table looking like this:
<div id=''endOfOriginStops''></div>
and to have whatever Javascript run something like this:
new Insertion.Before(''endOfOriginStops'',
''<tr><td>Bite me</td></tr>'');
Didn''t work. (in IE6). Either died quietly or gave some message about
''invalid target element for this operation''
Ultimately, ended up creating this script
function ieAppendRow(tableName, rowText) {
var tbl = $(tableName);
var row = tbl.insertRow();
var cell = row.insertCell(0);
var textNode = document.createTextNode(rowText);
cell.appendChild(textNode);
}
and calling it like
ieAppendRow(''originStops'', ''Bite
me'');
This works fine in IE6. Doesn''t do diddly in FireFox.
>From a few threads I''ve found, I gather IE6 is rather quirky in how
in
handles innerHTML, and have seen some illusions to the Prototype library
not handling this correctly. Is this assertion correct? Do I need to
bypass the library for this functionality, or am I missing something?
Thanks
Ed
--
Posted via http://www.ruby-forum.com/.