I'm trying to create a few menus using prototype.js "insert" function.
I create a table using 'new Element("table")', insert it in DIV and
then add links - one row per link (or the other way round - create a
full table, then insert it).
I initially wrote a code that worked fine in Firefox, but did not in
IE (currently testing with 6.0):
function addLinkToTable(table, link){
var r = new Element("tr");
var c = new Element("td");
table.insert(r.insert(c.insert(link)));
}
The table gets built but is not visible in IE. Then the alternative
function below do not use "new Element()", but instead uses the
standard DOM method to add rows. And it works also in IE:
function addLinkToTable(table, link){
var r = table.insertRow(table.rows.length);
var c = r.insertCell(0);
$(c).insert(link);
}
in fact it's just adding of the row that seems to fail when using "row
= new Element("tr"); table.insert(row)".
I wonder is this something that is "not supposed" to work with
prototype? BTW, if I check the table content created by the first
approach (innerHTML of my DIV), the table looks reasonably good, only
is not visible. In fact if I write:
mydiv.insert (table.outerHTML);
instead of
mydiv.insert (table);
it becomes visible, but of course outerHTML is not not a portable code
and in this way I loose the event handlers for my links, etc. Bad IE
again, or I'm overlooking something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---