I must validate a textbox that is an input for credit card.I try and find this code.I would like your opinion.Thanks.
Code:<script> function validate() { var cardexp=/^\d{4}\s{0,}\d{4}\s{0,}\d{4}\s{0,}\d{4}$/ if (!cardexp.test(document.frmname.fldname.value)) { document.number.fldname.value="Please enter your credit card number"; document.number.fldname.focus(); return false } } </script> <input type="text" size="10" maxlength="9" name="number" value="" onmouseout="return Validate()"/>



Reply With Quote

Bookmarks