
Thank you all for helping me with this
|
|
|
|
Java Script Credit Card form creation with some additional requirement
Page 1 of 1
Java Script Credit Card form creation with some additional requirement with some additional requirements#2Posted 11 May 2009 - 08:07 PM
It is site policy that we ask for a "best effort" attempt at solving the problem yourself first and then we can assist you. This means we do not provide code for you unless you show us what steps you have taken to do the work yourself. Show us what code you have written to actually try and solve the problem, we can then give you a push in the right direction.
#3Posted 11 May 2009 - 08:11 PM
so far I have only Credit Card validation
function onlydigits(str) { var re = new RegExp("([0-9]+)"); return (re.exec(str)!=null && RegExp.$1==str); } function checkccnumber(cardnum ) { var cardnum = fld1.value; if(cardnum.length > 0) cardnum = cardnum.replace(/ /gi,''); if(cardnum.length > 0) cardnum = cardnum.replace(/-/gi,''); if (cardnum.length<13 || cardnum.length>16) { alert("Credit card numbers must contain between 13 and 16 digits."); return false; } if (!onlydigits(cardnum)) { alert("Credit card numbers must contain only digits."); return false; } var no_digit = cardnum.length; var oddoeven = no_digit & 1; var sum = 0; for (var count = 0; count < no_digit; count++) { var digit = parseInt(cardnum.charAt(count),10); if (!((count & 1) ^ oddoeven)) { digit *= 2; if (digit > 9) digit -= 9; } sum += digit; } if (sum % 10 != 0) { alert("Credit card number is not valid. Please check that all digits were entered correctly."); return false; } return true; } #4Posted 11 May 2009 - 08:13 PM
And what exactly are the problems you are having? Have you tried anything and it is not working? That is what I meant by showing us what you have "tried" but with no success.
This means you should have a question like "I am trying to do ______ but it is doing ______ and I don't understand why."
Page 1 of 1
Fast Reply
1 User(s) are reading this topic
|
||||||||
Forum Index:
Programming Help |
C and C++ |
VB6 |
Java |
VB.NET |
C# |
ASP.NET |
PHP |
ColdFusion |
Perl and Python |
Ruby |
Databases |
Other Languages |
Game Programming |
Mobile Development |
Software Development |
Computer Science |
Industry News |
52 Weeks Of Code |
Programming Tutorials |
C++ Tutorials |
Visual Basic Tutorials |
Java Tutorials |
VB.NET Tutorials |
C# Tutorials |
Linux Tutorials |
PHP Tutorials |
ColdFusion Tutorials |
Windows Tutorials |
HTML/JavaScript Tutorials |
CSS Tutorials |
Flash Tutorials |
Web Promotion Tutorials |
Graphic Design & Photoshop Tutorials |
Software Development Tutorials |
Database Tutorials |
Other Language Tutorials |
ASP.NET Tutorials |
Game Programming Tutorials |
WPF & Silverlight Tutorials |
Mobile Development Tutorials |
Python Tutorials |
Ruby Tutorials |
