Hi guys 
I'm encountering the following problem :
I have a server-side generated table ...
... and I've found a prototype script that makes insertAdjacentHTML crossbrowser ...
... but, it seems that this method doesn't allow me to insert a row between two existing ones. I can only add something at the end of the document with document.body.insertAdjacentHTML .... which I don't need.
So, what row_add() should look like in order to make a row appear just below the concerned one?
I've tried ...
... but it triggers the following error :
Does it mean that it's totally impossible to append HTML to a non-dynamically produced row?
Many thanks for the help !!

I'm encountering the following problem :
I have a server-side generated table ...
Code:
...
<tr id="row_1">
<td><a href="javascript: row_add('row_1')">add new row under row_1</a></td>
<tr>
<tr id="row_2">
<td><a href="javascript: row_add('row_2')">add new row under row_2</a></td>
<tr>
...
... and I've found a prototype script that makes insertAdjacentHTML crossbrowser ...
Code:
// PROTOTYPES
if( typeof HTMLElement != "undefined" && !HTMLElement.prototype.insertAdjacentElement ) {
HTMLElement.prototype.insertAdjacentElement = function( where , parsedNode ) {
switch ( where ) {
case 'beforeBegin':
this.parentNode.insertBefore( parsedNode ,this )
break;
case 'afterBegin':
this.insertBefore( parsedNode , this.firstChild );
break;
case 'beforeEnd':
this.appendChild( parsedNode );
break;
case 'afterEnd':
if ( this.nextSibling )
this.parentNode.insertBefore( parsedNode , this.nextSibling );
else this.parentNode.appendChild( parsedNode );
break;
}
}
HTMLElement.prototype.insertAdjacentHTML = function( where , htmlStr ) {
var r = this.ownerDocument.createRange();
r.setStartBefore( this );
var parsedHTML = r.createContextualFragment( htmlStr );
this.insertAdjacentElement( where , parsedHTML );
}
HTMLElement.prototype.insertAdjacentText = function ( where , txtStr ) {
var parsedText = document.createTextNode( txtStr );
this.insertAdjacentElement( where , parsedText );
}
}
... but, it seems that this method doesn't allow me to insert a row between two existing ones. I can only add something at the end of the document with document.body.insertAdjacentHTML .... which I don't need.
So, what row_add() should look like in order to make a row appear just below the concerned one?
I've tried ...
Code:
document.getElementById( 'row_1' ).appendChild('<tr><td>something</td></tr>');
... but it triggers the following error :
Error: uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLTableRowElement.appendChild]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: javascript: document.getElementById( 'row_1' ).appendChild('<tr><td>something</td></tr>'); :: <TOP_LEVEL> :: line 1" data: no]
Does it mean that it's totally impossible to append HTML to a non-dynamically produced row?
Many thanks for the help !!
