Bin e padrões para validação de cartão de crédito.
| Bandeira | Começa com | Máximo de número | Máximo de número cvc |
|---|---|---|---|
| Visa | 4 | 13,16 | 3 |
| Mastercard | 5 | 16 | 3 |
| function checkCard(num){ | |
| var msg = Array(); | |
| var tipo = null; | |
| if(num.length > 16 || num[0]==0){ | |
| msg.push("Número de cartão inválido"); | |
| } else { | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>Holy Grail</title> | |
| <style> | |
| /* some basic styles. nothing to do with flexbox */ | |
| header, footer, | |
| nav, article, aside { | |
| border: 1px solid black; |
| <!-- Include jQuery from somewhere, must use version 1.8 or above --> | |
| <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
| <!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases --> | |
| <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script> | |
| <!-- Initialize the plugin, the contents of the script can be inlined here, of course --> | |
| <script type="text/javascript" src="js/init.js"></script> |