Javascript Reference
Categories: DOMException

javascript DOMException code

@March 15, 2008, 1:22 a.m.
code Firefox/Netscape/NN 6 IE n/a Chrome/Safari/DOM 1  

 

Read-only  

Provides an integer corresponding to one of the defined DOM error types. The following table lists all code values, their constant equivalents, and examples of what kinds of problems throw the exception.

 
Code Constant Most likely cause
1 INDEX_SIZE_ERR An integer offset parameter is out of the range of the target object
2 DOMSTRING_SIZE_ERR Property string value is too large for the hosting language
3 HIERARCHY_REQUEST_ERR Appending a child to a node not capable of children
4 WRONG_DOCUMENT_ERR Inserting a node created from a different document (without passing through the import process)
5 INVALID_CHARACTER_ERR Assigning an identifier with an illegal character
6 NO_DATA_ALLOWED_ERR Assigning data to a node that doesn't allow data
7 NO_MODIFICATION_ALLOWED_ERR Assigning a value to a read-only property
8 NOT_FOUND_ERR Method parameter reference to a nonexistent node in the object's scope
9 NOT_SUPPORTED_ERR Invoking an XML-only method in an HTML document
10 INUSE_ATTRIBUTE_ERR Method parameter to an Attr node that already belongs to another element (without cloning the Attr first)
11 INVALID_STATE_ERR Referencing a node that is not readable or writable
12 SYNTAX_ERR A slippery keyboard
13 INVALID_MODIFICATION_ERR Modifying the type of a node
14 NAMESPACE_ERR Namespace mismatch or malformed name
15 INVALID_ACCESS_ERR You can't go there
 
Example
 
if (e.code == e.INVALID_CHARACTER_ERR) {
    // process for an illegal identifier character
}
 
Value

Integer

 
Default

Determined by error.

 

Under moderation.
ascendwfbnwc - 2016-05-01

Powered by Linode.