visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Web :: Browser issues :: Cannot enlist option in select element, firefox 3.5.3


By: omuyelijah Nigeria  Date: 04/11/2009 12:47:57  English  Points: 20 Status: Answered
Quality : Excellent
Hi all,

Have dis code below in javascript 2 add an option element to a select element. It works 4 IE & Opera but fails in Moz. Firefox 3.5.3 in d indicated line as shown below:

try{ var opt; // option element 2 add for(var i=0; i<nodes.length; i++) { opt=document.createElement('option'); opt.setAttribute('label',nodes.childNodes[0].text); opt.setAttribute('value', nodes.childNodes[1].text + ','+ nodes.childNodes[2].text); obj.add(opt,obj.length); //line causing exception opt=null; } } catch(e){alert(e);}



The exception is:

Error: uncaught exception: [Exception... "Could not convert JavaScript argument arg 1 [nsIDOMHTMLSelectElement.add]"
nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"


Can any1 pls help? Thanks in advance
By: omuyelijah Date: 05/11/2009 15:17:53 English  Type : Answer
Hi all,

I was able to work out a way from this trouble by rewriting code that IE, Opera and Mozilla could agree. I wonder why Firefox didnt work with the 2 changed lines of code.

try { var opt; // option element 2 add for(var i=0; i<nodes.length; i++) { opt=new Option(nodes.childNodes[0].text); opt.setAttribute('value', nodes.childNodes[1].text + ','+ nodes.childNodes[2].text); obj.add(opt,null); opt=null; } } catch(e){ alert(e); }



However, am coming 2 see some likely bugs with Firefox 3.5.3. Some parts of html user interface appears disabled (which i didn't specify 4rm code). The error console just reports nothing. I'll still work on it 2 c why b4 attempting 2 report it.

Do register to be able to answer

EContact
browser fav
page generated in 482.975010 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page