[Phpwm] Javascript / IE / prototype issues.

Peter Measham pmeasham at gmail.com
Fri May 25 19:33:26 BST 2007


On 5/25/07, Paul Matthews <paul.matthews.86 at gmail.com> wrote:
> Good afternoon,
>
> I've been having a problem today, with the above mentioned: IE + Javascript
> + prototype and I'm hoping someone on the list can help / point me in the
> right direction.
>
> The task I'm trying to do (well part of it anyway) is copy a row of data and
> create a new row exactly the same after it. As I've mentioned a few times
> before, I'm using the prototype framework to do so, but I've run into what
> I'd consider to be flaws:
> 1) There's no HTML Object to HTML code, though innerHTML is close, it's not
> the entirely there.
> 2) all of prototype's DOM insert methods take in html strings (and use
> string id's for inserting before / after / above / down).
> 3) When I've tried to use the methods with innerHTML I've got from other
> objects, nothing happens.
> 4) IE seems to not like innerHTML very much, I've come across a lot of
> problems, trying to do it, of course none of the errors are helpful either.
> 5) When trying to clone the objects for obj.appendChild(cloned_obj), the
> objects are shallow cloned, which to all intents and purposes is pointless!
> 6) I can't seem to appendChild() on a select element with option elements,
> god knows why but even Firefox doesn't like that one, it gives an error 'Node
> cannot be inserted at the specified point in the hierarchy" code: "3'
>
> So all in all, I've spent ages on this problem and I'd really appreciate any
> assistance people could give. The original code looked like this:
>
> ### start ###
>
> function addAnotherProduct() {
>     table = $('products_table');
>     new_row = table.insertRow(-1);
>     new_row.className = "partRow";
>     new_row.innerHTML = table.rows[1].innerHTML;
> }
>
> #### end ###
>
> I'd give you the most recent code, but it's been through around 30 changes
> today, non of which have worked.
>
> I'm really hoping a fresh pair of eyes on this will see something that I
> really can't.
>
> Good luck, from Paul Matthws
>
> (and thank you to anyone who replies, no matter how useful).
> _______________________________________________
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/phpwm
>

This article should help:

http://developer.mozilla.org/en/docs/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces

Examples work in IE to.

Peter Measham



More information about the Phpwm mailing list