<html>
<head>
<title>example</title>
<SCRIPT>
function generateError() {
var diputree = parent.frames["diputree"].document.diputree;
diputree.setValue("blah blah","oops");
if ( diputree.hasException() ) {
alert (diputree.getException() );
}
if ( diputree.hasException() ) {
alert ("This can't happen!");
}
}
</SCRIPT>
</head>
<body>
<form>
<p>generate an error:
<p><input type="button" value="generate" onClick="generateError();">
</form>
</body>
</html>
Check if there was an error
if ( diputree.hasException() ) {
If there was an error then display an alert with the exception
alert (diputree.getException() );
}
The next expression can never be true, because the getException() method cleared the exception.
if ( diputree.hasException() ) {
alert ("This can't happen!");
}