Skip to main content

Credit Card Validation in JavaScript

Using simple algorithm the credit card number can be validated.

Each credit card type has his own rules for numbers to start from and for lengh of the number.

IssuerIdentifier Card Number Length
  • Diner's Club/Carte Blanche 300xxx-305xxx,36xxxx, 38xxxx 14
  • American Express 34xxxx, 37xxxx 15
  • VISA 4xxxxx 13, 16
  • MasterCard 51xxxx-55xxxx 16
  • Discover 6011xx 16

Following article explains in details what means digits in credit card numbers.

More full example with source code can be found here.

Comments

Popular posts from this blog

Reflector for .Net - amaizing how open your .Net source code

Reflector for .Net - Reflector is the class browser, explorer, analyzer and documentation viewer for .NET. Reflector allows to easily view, navigate, search, decompile and analyze .NET assemblies in C#, Visual Basic and IL. At same site there are also other interesting tools like: Resourcer for .NET - Resourcer is an editor for .resources binaries and .resX XML file formats used with the .NET platform Mapack for .NET - Mapack is a .NET class library for basic linear algebra computations.

Asynchronous pages in C# - When to Use It?

When do we need asynchronous page in ASP.net. Suppose you have a website with two web pages. One is your home page which display's a greeting, and the second page displays a large dataset from a database. You have 25 threads in your thread pool. 25 people simultaneously are accessing the database query page, and one additional person comes onto the site to see the home page which has static content on it. http://davidjberman.com/blogs/csharp/archive/2007/08/13/how-to-create-asynchronous-asp-net-pages-using-c.aspx

Dynamic Data Error - "'DropDownList1' has a SelectedValue which is invalid because …"

During my first investigation of Dynamic Data Support at .NET 3.5 environment, I've found that even Microsoft has bug :-))) After the following great instructions of following screen-cast I've finished in few minutes with applications that allows me to maintain all my database tables. The problem is that already at third screen I've played with I got following error message: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Fortunately, I'm not the first who is plying with Dynamic Data at .NET 3.5 so at this blog you can find fix and good explanation of this bug.