I *am* able to insert before a <p id="hh"> tag, but not before a <dl
id="hh"> tag.
i am able to do a body.appendChild with no trouble.
Finally, winIE6 pops an error: 'Invalid argument' at the last snip line
below (FF1.5 fails silently):
A snip from my code:
****
var newA = document.createElement("A");
var refObj=document.getElementById("hh");
//document.body.appendChild(newA); //works fine
document.body.insertBefore(newA,refObj);// winIE6 error: 'Invalid argument'
****
Any ideas why this is happening Is it me? or is there some rule I've
not been able to find?
Thanks for any help.
P.S. Same problem if I use "div1", a div wrapper around the dl node,
instead of body node.
emichael b.
e michael brandt wrote:
> A snip from my code:
>
> ****
> var newA = document.createElement("A");
>
> var refObj=document.getElementById("hh");
>
> //document.body.appendChild(newA); //works fine
> document.body.insertBefore(newA,refObj);// winIE6 error: 'Invalid argument'
You want/need
if (refObj != null) {
refObj.parentNode.insertBefore(newA, refObj);
}
You always need to call the DOM methods insertBefore and appendChild on
the parent node you want to append to or insert into.
--
Martin Honnen
http://JavaScript.FAQTs.com/
emichael