> can u post the code?

The two functions are taken from external javascript files. Thanks.


<html>
<head>
<title></title>

<script language="JavaScript" type="text/javascript">
<!-- 
// checkHasInteger() checks to see if the quantity is zero or a positive
integer. If 'required' is set to true,
// a value must be supplied; otherwise it will throw an error only if
it's not zero or a positive integer.
function checkHasInteger(field, required, message) {
   if (arguments.length == 3)
      var alertMsg = message;
   else 
      var alertMsg = "Please enter a whole number.";

   switch(required) {
      case false:
         if (field.value.length > 0 && !isPositiveInteger(field.value))
{
            alert(alertMsg);
            field.focus();
         }
         break;
      case true:
         if (field.value == null || field.value.length == 0 ||
!isPositiveInteger(field.value)) {
            alert(alertMsg);
            field.focus();
         }
         break;
   }
}

// isPositiveInteger checks to see if the numeric argument is an integer
>= 0.
function isPositiveInteger(testNumber) {
   if (isNaN(testNumber) || testNumber < 0 || testNumber.indexOf(".") !=
-1) {
      return false;
   } else {
      return true;
   }
}
// -->
</script>

</head>
<body>

<form>

<input type="Text" name="staff" value="" maxlength="4"
onFocus="this.select();" onBlur="checkHasInteger(this, true);">
<input type="Text" name="customers" value="" maxlength="4"
onFocus="this.select();" onBlur="checkHasInteger(this, true);">

</form>

</body>
</html>

-- 
Aidan Whitehall <[EMAIL PROTECTED]>
Macromedia ColdFusion Developer
Fairbanks Environmental Ltd  +44 (0)1695 51775

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to