Hi,
I wrote this script in order to calculate and id number, if it is fake or not...:
CODE:
function valId (s)
{
alert ("ENTERD function valId");
if (s.length < 5)
alert ("ID 2 SHORT!!!!");
else
{
alert ("ENTERED FIRST ELSE...");
var i;
temp:integer = 0;
total:integer = 0;
// loops through id num and calculates SUM = total
for (i = s.length - 1; i >= 0; i--)
{
alert ((s.charAt(i)).toString());
if ((i % 2) == 0)
{
temp = s.charAt(i)*2;
if (temp >9)
{
alert ("GADOL ME 9");
temp = temp - 10;
total = total + temp +1;
}
else
total = total + temp;
}
else
{
total = total + s.charAt(i);
}
alert ((total).toString());
}
}
if ((total % 10) == 0)
alert ("GOODID");
else
alert ("BADID");
return returnString;
}
</script>
SOMEHOW the code concatenates = gives a string instead of giving out the methematical result....
CAN ANY 1 TELL WHERE I AM GOING WRONG???
THANX A MILLION....
JUD.


