Solved

wierd js error

Posted on 2006-10-29
3
992 Views
Last Modified: 2008-01-09
Error: uncaught exception: [Exception... "Node cannot be inserted at the specified point in the hierarchy"  code: "3" nsresult: "0x80530003 (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)"  location: "file.js Line: 34"]

the code that caused it is this:

if(isUndefined(option.childNodes[0])) {
                        var txtNode = document.createTextNode(data);
                  /* line 34 */      option.appendChild(txtNode);
                  }
0
Comment
Question by:wrynn
  • 2
3 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 17828330
What do you intend to do there?
Do you know the simple stright way to create Options?
Like this:

   var opt = document.forms[0].yourSelectName.options;
   opt[opt.length] = new Option("theOption Text", "theOptValue");

0
 

Author Comment

by:wrynn
ID: 17829222
im trying to check to see if the option node has a text node, if it doesnt then i append one to it
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 17830617
What is an option Node for you?
If it is a select option, then it is like this:

   var opt = document.forms[0].yourSelectName.options;
   if(opt[0].text==""){
      opt[0].text = "Option Text";
   }

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question