[thelist] appendChild() exception

joe stowaway at uklinux.net
Wed Oct 22 13:55:06 CDT 2003


hi folks

I'm having trouble with a script with a scrip that uses appendChild.  I 
have a checkbox in a form, which calls a a javascript function when 
clicked.  the function tries to appendChild() to that element, but IE 
and Moz aren't having it. the script works fine if I appendChild() to 
other elements that _aren't_ form controls.

the errors it throws are:

IE6: "Unexpected call to method or property access"

Moz 1.2b "Error: uncaught exception: [Exception... "Component returned 
failure code: 0x80004005 (NS_ERROR_FAILURE) 
[nsIDOMHTMLInputElement.appendChild]"  nsresult: "0x80004005 
(NS_ERROR_FAILURE)"  location: "JS frame :: http://10.0.0.3/dev/test.php 
:: toggle :: line 29"  data: no]"

I've found this exception for appendChild()

> Exceptions:  
>
> DOMException HIERARCHY_REQUEST_ERR
>     Raised if this node is of a type that does not allow children of 
> the type of the newChild node, or if the node to append is one of this 
> node's ancestors or this node itself.

but I can't find anywhere that lists exactly what exactly nodes do not 
allow children or whether form controls are such nodes.  anyone able to 
point me in the right direction?  I've looked at the w3c spec and it 
seems to state that HTMLInputElements inherit appendChild methods, so 
I'm kind of bamboozled :(

tia  :)

joe



More information about the thelist mailing list