Busted Mug

A blog that documents solutions to the most frustrating problems that occur during development in technologies such as Java, XML, AJAX, SQL, CSS and others that make me want to throw my coffee mug against the cube wall.

Thursday, November 30, 2006

Select boxes and "Could not convert JavaScript argument" (NS_ERROR_XPC_BAD_CONVERT_JS)

While trying to add a dynamically generated option to a select box I ran into this error:
Error: uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: file:///C:/Documents%20and%20Settings/mmbmb/Desktop/calendar%20de3v/calendarDateInput.js :: PickDisplayDay :: line 148" data: no]
I was perplexed for some time until I did a little research and ran into this page on Quirksmode. The solution lies here:
 for(i=0;i
I was trying to call the .add method of a select using text as an argument. This is non-standard (but I think works in IE). You have to instantiate an option object or else JS will error while trying to convert. Quirksmode is great btw.

0 Comments:

Post a Comment

<< Home