javascript DOMException code

codeNN 6 IE n/a 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.

 
CodeConstantMost likely cause
1INDEX_SIZE_ERRAn integer offset parameter is out of the range of the target object
2DOMSTRING_SIZE_ERRProperty string value is too large for the hosting language
3HIERARCHY_REQUEST_ERRAppending a child to a node not capable of children
4WRONG_DOCUMENT_ERRInserting a node created from a different document (without passing through the import process)
5INVALID_CHARACTER_ERRAssigning an identifier with an illegal character
6NO_DATA_ALLOWED_ERRAssigning data to a node that doesn't allow data
7NO_MODIFICATION_ALLOWED_ERRAssigning a value to a read-only property
8NOT_FOUND_ERRMethod parameter reference to a nonexistent node in the object's scope
9NOT_SUPPORTED_ERRInvoking an XML-only method in an HTML document
10INUSE_ATTRIBUTE_ERRMethod parameter to an Attr node that already belongs to another element (without cloning the Attr first)
11INVALID_STATE_ERRReferencing a node that is not readable or writable
12SYNTAX_ERRA slippery keyboard
13INVALID_MODIFICATION_ERRModifying the type of a node
14NAMESPACE_ERRNamespace mismatch or malformed name
15INVALID_ACCESS_ERRYou can't go there
 
Example
 
if (e.code == e.INVALID_CHARACTER_ERR) {
    // process for an illegal identifier character
}
 
Value

Integer

 
Default

Determined by error.


642,Nickname,Homepage or email,Comments here,Add comment