code (W3C DOM Core property)
| Version | Depr. | Static | Read-only |
|---|---|---|---|
| DOM1 | No | No | Yes |
| IE7 | FF1.5+ | SA1.3+ | OP9+ |
|---|---|---|---|
| None | Full | Full | Full |
Example
try
{
var node = document.getElementsByTagName('h1').item(0);
var refnode = node.nextSibling;
var newnode = document.createTextNode('That is why you fail.');
node.insertBefore(newnode, refnode);
}
catch(err)
{
alert(err.code);
}
The example above shows an insertBefore operation that will fail, because
refnode is not a child of node. That
operation produces a code 8 exception (NOT_FOUND_ERR).
Description
The
ExceptionCode integer that refers to the type of a
DOMException.
This property is readonly.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.5 | 2.0 | 3.0 | 1.3 | 2.0 | 3.0 | 9.0 | 9.5 |
| None | None | None | Full | Full | Full | Full | Full | Full | Full | Full |
Internet Explorer does not implement the DOMException interface, and uses its native error
reporting syntax only.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.