After seeing the following documentation:
http://www.croczilla.com/~alex/refer...t.html#1051663
I decided to try using a try/catch block in my own JavaScript test
file. But it didn't work. Here's the complete file:
<html>
<head>
</head>
<body>
<script type="text/javascript">
function doParse() {
var txt = document.forms[0].inNum.value
try {
obj = new Packages.java.math.BigInteger(txt)
document.forms[0].outRes.value = "It's an integer!"
return
} catch (ex) {
document.forms[0].outRes.value = "(BigInteger parse failed)"
}
}
</script>
<form>
Type your input here: <input type="text" name="inNum" size="10">
<input type="button" onclick="doParse()"
value="Try to parse that">
<br />
See the parse result here: <input type="text" name="outRes" size="30">
</form>
</body>
</html>
and here's the first error it reported:
try is a reserved identifier.
try {
....^
(After that error caused doParse not to be defined, of course it then
reported that doParse wasn't defined where I tried to use it later.)