<HTML>
<head>
<SCRIPT language="javascript" type="text/javascript">
// anyMask found on web library
function anyMask(event, sMask) {
var KeyTyped = String.fromCharCode(getKeyCode(event));
var targ = getTarget(event);
keyCount = targ.value.length;
if (sMask.charAt(keyCount) == '*')
return true;
if (sMask.charAt(keyCount) == KeyTyped) {
return true;
}
if ((sMask.charAt(keyCount) == '#') && isNumeric(KeyTyped))
return true;
if ((sMask.charAt(keyCount) == 'A') && isAlpha(KeyTyped))
return true;
if ((sMask.charAt(keyCount) == '?') && isPunct(KeyTyped))
return true;
if (KeyTyped.charCodeAt(0) < 32) return true;
return false;
}
function getTarget(e) {
// IE5
if (e.srcElement) {
return e.srcElement;
}
if (e.target) {
return e.target;
}
}
function getKeyCode(e) {
//IE5
if (e.srcElement) {
return e.keyCode
}
// NC5
if (e.target) {
return e.which
}
}
function isNumeric(c)
{
var sNumbers = "01234567890";
if (sNumbers.indexOf(c) == -1)
return false;
else return true;
}
function isAlpha(c)
{
var lCode = c.charCodeAt(0);
if (lCode >= 65 && lCode <= 122 )
{
return true;
}
else
return false;
}
function isPunct(c)
{
var lCode = c.charCodeAt(0);
if (lCode >= 32 && lCode <= 47 )
{
return true;
}
else
return false;
}
</SCRIPT>
<SCRIPT language="JavaScript" type="text/javascript">
function IsValidTime(fldName,timeStr) {
/* Checks if time is in HH.MM format.
Takes no separator so client can use numeric pad entirely.*/
/* check for no entry or < 4 characters
completely blank is OK for this routine,
if a required field, other means must enforce*/
mhour = timeStr.substring(0,2)
mmin = timeStr.substring(2,4)
if (mhour=="" && mmin=="" {
return true;
}
/*check if time entry is less than four numbers -
if so it is not acceptable */
if (timeStr.length < 4) {
alert("Use four numbers - military time format - e.g 1536"
fldName.value="";
fldName.focus();
fldName.select();
return false;
}
if (mhour < 0 || mhour > 23) {
alert("24 hour format -must be between 0 and 23)"
fldName.value="";
fldName.focus();
fldName.select();
return false;
}
if (mmin<0 || mmin > 59) {
alert ("Minute must be between 0 and 59."
fldName.value="";
fldName.focus();
fldName.select();
return false;
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.