Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
html DOM : unable to insertBefore a DL node.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
e michael brandt  
View profile  
 More options Feb 10 2006, 1:23 pm
Newsgroups: comp.lang.javascript
From: e michael brandt <mich...@valleywebdesigns.com>
Date: Fri, 10 Feb 2006 18:23:09 GMT
Local: Fri, Feb 10 2006 1:23 pm
Subject: html DOM : unable to insertBefore a DL node.
I am frustrated.  It appears that one can not use insertBefore to insert
an A node before a DL node.  Is that really true?

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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Honnen  
View profile  
(1 user)  More options Feb 10 2006, 1:33 pm
Newsgroups: comp.lang.javascript
From: Martin Honnen <mahotr...@yahoo.de>
Date: Fri, 10 Feb 2006 19:33:41 +0100
Local: Fri, Feb 10 2006 1:33 pm
Subject: Re: html DOM : unable to insertBefore a DL node.

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/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
e michael brandt  
View profile  
 More options Feb 10 2006, 1:54 pm
Newsgroups: comp.lang.javascript
From: e michael brandt <mich...@valleywebdesigns.com>
Date: Fri, 10 Feb 2006 18:54:17 GMT
Local: Fri, Feb 10 2006 1:54 pm
Subject: Re: html DOM : unable to insertBefore a DL node.
wow!  That works perfectly.  I read every google hit I could find and
never did I see this.  Thanks so much!

emichael


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google