How to use regular JS to control users to enter bank card number and format
This article is about how JS uses rules to control users to enter bank card numbers and formatting. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
/ / js regularization realizes the control and formatting of bank card number input by users.
Function formatBankNo (BankNo) {if (BankNo.value = "") return; var account = new String (BankNo.value); account = account.substring (0meme 22) / * Total number of accounts Including spaces * / if (account.match (". [0-9] {4}-[0-9] {4}-[0-9] {4}-[0-9] {7}") = null) {/ * contrast format * / if (account.match (". [0-9] {4}-[0-9] {4}-[0-9] {4}-[0-9] {7} |" + ") [0-9] {4}-[0-9] {4}-[0-9] {7} | "+". [0-9] {4}-[0-9] {4}-[0-9] {4}-[0-9] {7} | "+". [0-9] {4}-[0-9] {4}-[0-9] {7} " ) = = null) {var accountNumeric = accountChar = "" I For (iSuppli)