I'm trying to figure out why my code is not triggering past a certain point. In the below code the alert for Luhn is displaying fine but it appears to not progress past that. So it appears i am successfully passing the number from the onclick method but the function is not running because i'm not getting a true or false alert based on the rule set.
Any help appreciated
Thanks
<html>
<head>
<script type="text/javascript">
function Validate(Luhn) {
alert(Luhn);
var LuhnDigit = parseInt(Luhn.substring(Luhn.length - 1, Luhn.length));
var LuhnLess = Luhn.substring(0, Luhn.length - 1);
if (Calculate(LuhnLess) == parseInt(LuhnDigit)) {
alert("True");
return true;
}
alert("False");
return false;
}
</script>
</head>
<body>
<form>
<input type="form" id='fv'>
<input type="button" onclick="Validate('4111111111111111')" value="Call function">
</form>
</body>
</html>