javascript Get Credit Card Type By Number (regex validation example)
@May 21, 2009, 5:05 a.m.
document.write('3400 0000 0000 009=' + GetCreditCardTypeByNumber('3400 0000 0000 009'));
document.write('6011 0000 0000 0004=' + GetCreditCardTypeByNumber('6011 0000 0000 0004'));
document.write('5500 0000 0000 0004=' + GetCreditCardTypeByNumber('5500 0000 0000 0004'));
document.write('4111 1111 1111 1111=' + GetCreditCardTypeByNumber('4111 1111 1111 1111'));
function GetCreditCardTypeByNumber(ccnumber) {
var cc = (ccnumber + '').replace(/\s/g, ''); //remove space
if ((/^(34|37)/).test(cc) && cc.length == 15) {
return 'AMEX'; //AMEX begins with 34 or 37, and length is 15.
} else if ((/^(51|52|53|54|55)/).test(cc) && cc.length == 16) {
return 'MasterCard'; //MasterCard beigins with 51-55, and length is 16.
} else if ((/^(4)/).test(cc) && (cc.length == 13 || cc.length == 16)) {
return 'Visa'; //VISA begins with 4, and length is 13 or 16.
} else if ((/^(300|301|302|303|304|305|36|38)/).test(cc) && cc.length == 14) {
return 'DinersClub'; //Diners Club begins with 300-305 or 36 or 38, and length is 14.
} else if ((/^(2014|2149)/).test(cc) && cc.length == 15) {
return 'enRoute'; //enRoute begins with 2014 or 2149, and length is 15.
} else if ((/^(6011)/).test(cc) && cc.length == 16) {
return 'Discover'; //Discover begins with 6011, and length is 16.
} else if ((/^(3)/).test(cc) && cc.length == 16) {
return 'JCB'; //JCB begins with 3, and length is 16.
} else if ((/^(2131|1800)/).test(cc) && cc.length == 15) {
return 'JCB'; //JCB begins with 2131 or 1800, and length is 15.
}
return '?'; //unknow type
}
function IsValidCC(str) { //A boolean version
if (GetCreditCardTypeByNumber(str) == '?') return false;
return true;
}
document.write('6011 0000 0000 0004=' + GetCreditCardTypeByNumber('6011 0000 0000 0004'));
document.write('5500 0000 0000 0004=' + GetCreditCardTypeByNumber('5500 0000 0000 0004'));
document.write('4111 1111 1111 1111=' + GetCreditCardTypeByNumber('4111 1111 1111 1111'));
function GetCreditCardTypeByNumber(ccnumber) {
var cc = (ccnumber + '').replace(/\s/g, ''); //remove space
if ((/^(34|37)/).test(cc) && cc.length == 15) {
return 'AMEX'; //AMEX begins with 34 or 37, and length is 15.
} else if ((/^(51|52|53|54|55)/).test(cc) && cc.length == 16) {
return 'MasterCard'; //MasterCard beigins with 51-55, and length is 16.
} else if ((/^(4)/).test(cc) && (cc.length == 13 || cc.length == 16)) {
return 'Visa'; //VISA begins with 4, and length is 13 or 16.
} else if ((/^(300|301|302|303|304|305|36|38)/).test(cc) && cc.length == 14) {
return 'DinersClub'; //Diners Club begins with 300-305 or 36 or 38, and length is 14.
} else if ((/^(2014|2149)/).test(cc) && cc.length == 15) {
return 'enRoute'; //enRoute begins with 2014 or 2149, and length is 15.
} else if ((/^(6011)/).test(cc) && cc.length == 16) {
return 'Discover'; //Discover begins with 6011, and length is 16.
} else if ((/^(3)/).test(cc) && cc.length == 16) {
return 'JCB'; //JCB begins with 3, and length is 16.
} else if ((/^(2131|1800)/).test(cc) && cc.length == 15) {
return 'JCB'; //JCB begins with 2131 or 1800, and length is 15.
}
return '?'; //unknow type
}
function IsValidCC(str) { //A boolean version
if (GetCreditCardTypeByNumber(str) == '?') return false;
return true;
}
Permanent URL:
http://javascript.gakaa.com/credit-card-type-by-number.aspx
President Donald Trump speaks to reporters at the White House in Washington, DC, on January 30. Chip Somodevilla/Getty Images
CNN
—
Just about everyone thought it was a bluff. Top analysts from the biggest banks on Wall Street said it was highly unlikely. Stocks were trading like it wouldn’t happen. Some companies built contingency plans, but they weren’t exactly rushing to make changes.
<a href=https://bs2web.ac>bslp at</a>
But the tariffs are coming — in full force. President Donald Trump announced Saturday that a massive 25% tariff on all goods from Mexico and most imports from Canada will go into effect Tuesday. An additional 10% tariff on Chinese goods will be enacted the same day.
Trump in a message posted on Truth Social Sunday said, “We don’t need anything they have. We have unlimited Energy, should make our own Cars, and have more Lumber than we can ever use.” But America’s supply chains are reliant on its trading partners, and even for goods that could be grown or produced exclusively in the United States, the complex web of interconnected global trade cannot easily be unwound.
<a href=https://bsme.top>black sprut</a>
So the additional costs on foreign-made goods will be paid by American importers, who typically pass those costs onto retailers, who pass them onto inflation-weary consumers. That means prices will rise — although, for most items, not immediately. Businesses’ profits will be squeezed as they bear the cost burden of the tariffs or pay to adjust their carefully constructed and at times inflexible supply chains.
That’s why stocks on Monday were set to tumble. Dow futures were more than 600 points, or 1.3% lower. S&P 500 futures sank 1.5%. and Nasdaq futures were 1.7% lower.
Globally, stocks fell, too. Major European indexes were down across the board, and Asian markets closed sharply lower. Bitcoin and other cryptos tumbled, brought down by growing fears of a recession. The US dollar rose sharply.
Energy costs surged: US crude oil rose 2.3% and natural gas spiked 7%. Despite a lower 10% tariff on Canadian electricity, natural gas and oil exports to the United States, the energy industry said it will not be able to quickly or easily find alternate sources. Diesel and jet fuel costs in particular will rise, according to Angie Gildea, the US energy sector lead at accounting firm KPMG, adding costs to all shipped goods and air travel.
спрут
https://bs-me.at
“Any infrastructure upgrades would not happen overnight,” Gildea told CNN. “Tariffs on Canadian oil would increase costs for US refiners, leading to price hikes for consumers.”
Auto industry stock futures were particularly hard-hit, because virtually all American-made cars are manufactured at least in some part in Mexico or Canada — what was a free-trade zone. GM (GM) fell more than 6%, Jeep and Chrysler maker Stellantis (STLA) was down 5% and Ford (F) fell more than 3%.
CNN
—
Just about everyone thought it was a bluff. Top analysts from the biggest banks on Wall Street said it was highly unlikely. Stocks were trading like it wouldn’t happen. Some companies built contingency plans, but they weren’t exactly rushing to make changes.
<a href=https://bs2web.ac>bslp at</a>
But the tariffs are coming — in full force. President Donald Trump announced Saturday that a massive 25% tariff on all goods from Mexico and most imports from Canada will go into effect Tuesday. An additional 10% tariff on Chinese goods will be enacted the same day.
Trump in a message posted on Truth Social Sunday said, “We don’t need anything they have. We have unlimited Energy, should make our own Cars, and have more Lumber than we can ever use.” But America’s supply chains are reliant on its trading partners, and even for goods that could be grown or produced exclusively in the United States, the complex web of interconnected global trade cannot easily be unwound.
<a href=https://bsme.top>black sprut</a>
So the additional costs on foreign-made goods will be paid by American importers, who typically pass those costs onto retailers, who pass them onto inflation-weary consumers. That means prices will rise — although, for most items, not immediately. Businesses’ profits will be squeezed as they bear the cost burden of the tariffs or pay to adjust their carefully constructed and at times inflexible supply chains.
That’s why stocks on Monday were set to tumble. Dow futures were more than 600 points, or 1.3% lower. S&P 500 futures sank 1.5%. and Nasdaq futures were 1.7% lower.
Globally, stocks fell, too. Major European indexes were down across the board, and Asian markets closed sharply lower. Bitcoin and other cryptos tumbled, brought down by growing fears of a recession. The US dollar rose sharply.
Energy costs surged: US crude oil rose 2.3% and natural gas spiked 7%. Despite a lower 10% tariff on Canadian electricity, natural gas and oil exports to the United States, the energy industry said it will not be able to quickly or easily find alternate sources. Diesel and jet fuel costs in particular will rise, according to Angie Gildea, the US energy sector lead at accounting firm KPMG, adding costs to all shipped goods and air travel.
спрут
https://bs-me.at
“Any infrastructure upgrades would not happen overnight,” Gildea told CNN. “Tariffs on Canadian oil would increase costs for US refiners, leading to price hikes for consumers.”
Auto industry stock futures were particularly hard-hit, because virtually all American-made cars are manufactured at least in some part in Mexico or Canada — what was a free-trade zone. GM (GM) fell more than 6%, Jeep and Chrysler maker Stellantis (STLA) was down 5% and Ford (F) fell more than 3%.
DonaldKew
- 1 hours
Hi there, just became aware of your blog through Google, and found that it's truly informative. I'm going to watch out for brussels. I will appreciate if you continue this in future. Many people will be benefited from your writing. Cheers!
canadian viagra
- 3 hours
Powered by Linode.
</a>Каждая игра в Казино Аркада – это опыт и возможность.