I just want to validate a credit card number in the JavaScript code. I have used a regular expression for digit numbers, but I don't know why it is not working!
Here is my function as per below:
function validate_creditcardnumber()
{
var re16digit = /^d{16}$/
if (document.myform.CreditCardNumber.value.search(re16digit) == -1)
alert("Please enter your 16 digit credit card numbers");
return false;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…