Web :: Browser issues :: Cannot enlist option in select element, firefox 3.5.3 |
|||
| By: omuyelijah |
Date: 04/11/2009 12:47:57 |
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 | 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 |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








