function validate(obj) {
value = obj.value;
for (n = 0; n < value.length; n++)
if ( ! isDigit(value.charAt(n))) {
alert("Field must be numeric");
return;
}
confirm("Field is valid");
}
function isDigit(ch) {
if (ch >= '0' && ch <= '9')
return true;
return false;
}
And can be called by
<form>
Enter number:
<input type="text" onChange="validate(this)">
</form>
<STYLE TYPE="text/css"
<!--
BODY {background: yellow:}
P EM {background: green}
-->
</STYLE>
keystore "file:/home/jan/.keystore", "JKS";
// Permissions for downloaded classes
grant signedBy "Jan" {
permission java.net.SocketPermission
"137.92.11.117:1024-", "connect,accept,
resolve";
};
// Permissions for the Jini classes
grant codeBase "file:/home/jan/tmpdir/jini1_1/lib/-"
signedBy "Jini" {
// multicast request address
permission java.net.SocketPermission
"224.0.1.85", "connect,accept";
// multicast announcement address
permission java.net.SocketPermission
"224.0.1.84", "connect,accept";
};
Copyright © Jan Newmarch under the terms of the
Creative Commons Attribution 2.1 Australia License.