[clug-progsig] Strange exception with JavaScript.

Dave Lee dave at cherryville.org
Tue Feb 15 16:11:52 PST 2005


Aaron Rustad wrote:
> Error: uncaught exception: [Exception... "Component returned failure
> code: 0x80004002 (NS_NOINTERFACE)
> [nsIDOMHTMLTableRowElement.rowIndex]"  nsresult: "0x80004002
> (NS_NOINTERFACE)"  location: "JS frame ::
> http://localhost:3000/form/edit_fields/1 :: removeField :: line 65" 
> data: no]

I was messing around with some table manipulation recently, but I don't 
recognize this error.  I do recognize a rails url tho.

>     var tbCount=<%= @form.inputs.count %>;

yep, definitely rails.  how are you liking it?  new to ruby?  we should 
start up some ruby/rails discussions.

>       delLink.setAttribute('onClick', "removeField(n_" + (tbCount+1) + "); return false");

which would like:

<a href="#" onclick="removeField(n_23); return false">Delete</a>

can you do this?  does the call to removeField have the row object with 
id="n_23" in it's scope?

I'll post my table manipulation code/html later if people want, but what 
I was using a call to document.getElementById('n_23') in order to 
reference a row (actually, I was referencing a table, but this should be 
doable for rows too).  so maybe try changing the removeField function:

>     function removeField(rowToDelete) {

first, what if you added alert(rowToDelete.id); or 
alert(rowToDelete.rowIndex); what does this show you?  the right values?

if not, try changing the function like so:

function removeField(rowId) {
   rowToDelete = document.getElementById(rowId);
   ...
}

Dave



More information about the clug-progsig mailing list