This might help you

function isPostiveDecimal(num){
var validChars ="0123456789.";
var allValid = true;
   var decPoints = 0;
   var allNum = "";
for (i = 0;  i < num.length;  i++){
    ch = num.charAt(i);
    for (j = 0;  j < validChars.length;  j++)
       if (ch == validChars.charAt(j))
         break;
   
if (j == validChars.length)
    {
       allValid = false;
      break;
    }
    allNum += ch;
   }

if (allValid){
if (isNaN(Number(num)))
allValid = false;
}

   if (allValid){
if (Number(num) < 0)
allValid = false;
}

if(allValid)
return true;
else
return false;
}

Qasim

----- Original Message -----
From: Robert Orlini <[EMAIL PROTECTED]>
Date: Tue, 20 Jul 2004 15:42:03 -0400
Subject: OT: JS number check
To: CF-Talk <[EMAIL PROTECTED]>

I need a _javascript_ later to come up when anything but a number and/or
a decimal point is entered into a price each field. The _javascript_
below is not allowing the decimal point. Can anyone suggest what I
have to add or fix please?

function isNumber2(inputStr, field)
{
for(var i=0; i<inputStr.length; i++)
{
var charVal = inputStr.substring(i, i+1);
if(charVal < "0" || charVal > "9" || (charVal.value=="" ||
charVal.value ==",")) {
alert ("Please make sure your " + field + " entry are numbers only");
return false;
}
}
return true;

Robert Orlini
HW
ô¿ô________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to