?? jsinclude.js
字號:
FUNCTION: isEnRoute()
INPUT: cc - a string representing a credit card number
RETURNS: true, if the credit card number is a valid enRoute
card number.
false, otherwise
Sample number: 201400000000009 (15 digits)
================================================================ */
function isEnRoute(cc)
{
first4digs = cc.substring(0,4);
if ((cc.length == 15) &&
((first4digs == "2014") ||
(first4digs == "2149")))
return isCreditCard(cc);
return false;
}
/* ================================================================
FUNCTION: isJCB()
INPUT: cc - a string representing a credit card number
RETURNS: true, if the credit card number is a valid JCB
card number.
false, otherwise
================================================================ */
function isJCB(cc)
{
first4digs = cc.substring(0,4);
if ((cc.length == 16) &&
((first4digs == "3088") ||
(first4digs == "3096") ||
(first4digs == "3112") ||
(first4digs == "3158") ||
(first4digs == "3337") ||
(first4digs == "3528")))
return isCreditCard(cc);
return false;
} // END FUNCTION isJCB()
/* ================================================================
FUNCTION: isAnyCard()
INPUT: cc - a string representing a credit card number
RETURNS: true, if the credit card number is any valid credit
card number for any of the accepted card types.
false, otherwise
================================================================ */
function isAnyCard(cc)
{
if (!isCreditCard(cc))
return false;
if (!isMasterCard(cc) && !isVisa(cc) && !isAmericanExpress(cc) && !isDinersClub(cc) &&
!isDiscover(cc) && !isEnRoute(cc) && !isJCB(cc)) {
return false;
}
return true;
} // END FUNCTION isAnyCard()
/* ================================================================
FUNCTION: isCardMatch()
INPUT: cardType - a string representing the credit card type
cardNumber - a string representing a credit card number
RETURNS: true, if the credit card number is valid for the particular
credit card type given in "cardType".
false, otherwise
================================================================ */
function isCardMatch (cardType, cardNumber)
{
cardType = cardType.toUpperCase();
var doesMatch = true;
if ((cardType == "VISA") && (!isVisa(cardNumber)))
doesMatch = false;
if ((cardType == "MASTERCARD") && (!isMasterCard(cardNumber)))
doesMatch = false;
if ( ( (cardType == "AMERICANEXPRESS") || (cardType == "AMEX") )
&& (!isAmericanExpress(cardNumber))) doesMatch = false;
if ((cardType == "DISCOVER") && (!isDiscover(cardNumber)))
doesMatch = false;
if ((cardType == "JCB") && (!isJCB(cardNumber)))
doesMatch = false;
if ((cardType == "DINERS") && (!isDinersClub(cardNumber)))
doesMatch = false;
if ((cardType == "CARTEBLANCHE") && (!isCarteBlanche(cardNumber)))
doesMatch = false;
if ((cardType == "ENROUTE") && (!isEnRoute(cardNumber)))
doesMatch = false;
return doesMatch;
} // END FUNCTION CardMatch()
/* ================================================================
The below stub functions are retained for backward compatibility
with the original LivePayment code so that it should be possible
in principle to swap in this new module as a replacement for the
older module without breaking existing code. (There are no
guarantees, of course, but it should work.)
When writing new code, do not use these stub functions; use the
functions defined above.
================================================================ */
function IsCC (st) {
return isCreditCard(st);
}
function IsVisa (cc) {
return isVisa(cc);
}
function IsVISA (cc) {
return isVisa(cc);
}
function IsMasterCard (cc) {
return isMasterCard(cc);
}
function IsMastercard (cc) {
return isMasterCard(cc);
}
function IsMC (cc) {
return isMasterCard(cc);
}
function IsAmericanExpress (cc) {
return isAmericanExpress(cc);
}
function IsAmEx (cc) {
return isAmericanExpress(cc);
}
function IsDinersClub (cc) {
return isDinersClub(cc);
}
function IsDC (cc) {
return isDinersClub(cc);
}
function IsDiners (cc) {
return isDinersClub(cc);
}
function IsCarteBlanche (cc) {
return isCarteBlanche(cc);
}
function IsCB (cc) {
return isCarteBlanche(cc);
}
function IsDiscover (cc) {
return isDiscover(cc);
}
function IsEnRoute (cc) {
return isEnRoute(cc);
}
function IsenRoute (cc) {
return isEnRoute(cc);
}
function IsJCB (cc) {
return isJCB(cc);
}
function IsAnyCard(cc) {
return isAnyCard(cc);
}
function IsCardMatch (cardType, cardNumber) {
return isCardMatch (cardType, cardNumber);
}
//if all the checkboxes of account were unchecked ,then the "checkall" checkbox was unchecked.
//written by Charles Cao
//date:2000.8.14
function checknull(each,all){
var countit=0;
if (each.length==null)
{
all.checked=each.checked;
}
else
{
for(i=0;i<each.length;i++)
{
if (each[i].checked)
countit+=1;
}
if (countit==0)
all.checked=false;
}
}
//click the "checkall" button, then all the accounts or operators will be checked.
//written by Charles Cao
//date:2000.8.14
function checkall(each,all)
{
if(each.length==null)
{
each.checked=all.checked;
}
else
{
for(i=0;i<each.length;i++)
{
each[i].checked = all.checked;
}
}
}
//check if the date is valid at these format: yyyymmdd OR yymmdd
//written by Charles Cao
//date:2000.8.16
function validDate(my)
{
var cot=my.value;
if (cot.length==8)
{
var y=cot.substring(0,4);
if (cot.charAt(4)=='0')
var m=cot.substring(5,6);
else
var m=cot.substring(4,6);
if (cot.charAt(6)=='0')
var d=cot.substring(7);
else
var d=cot.substring(6);
}
if (cot.length==6)
{
var y=cot.substring(0,2);
if (cot.charAt(2)=='0')
var m=cot.substring(3,4);
else
var m=cot.substring(2,4);
if (cot.charAt(4)=='0')
var d=cot.substring(5);
else
var d=cot.substring(4);
}
if (cot.length==0)
return "0";
var a=isDate(y,m,d);
return a;
}
//these function is to show a layer
function Change()
{
aa.value=document.form2.changeIt.value;
}
function create(tag, left, top, width, height, visible, content)
{
var layer;
document.writeln('<div id="' + tag + '" style="position:absolute; overflow:none; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') + '">');
document.writeln(content);
document.writeln('</div>');
}
function creatediv(tag, left, top, width, height, visible, content)
{
var layer;
document.writeln('<div id="' + tag + '" style="overflow:none; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') + '">');
document.writeln(content);
document.writeln('</div>');
}
function hide(tag) {
var layer = get(tag);
layer.visibility = "hidden";
}
function show(tag) {
var layer = get(tag);
layer.visibility = "visible";
}
function get(tag) {
layer = eval('document.all.' + tag+ '.style');
return(layer);
}
function change(my) {
my.value=document.form2.changeIt.value;
}
//add dot to the number.
function dot(num) {
var count=0;
var numer=0;
for (i = 0; i < num.length; i++)
{
var c = num.charAt(i);
if (c == decimalPointDelimiter)
count=1;
}
if (count==0 && num.length>2)
numer=num.substring(0,num.length-2)+"."+num.substring(num.length-2);
if (count==0 && num.length<3)
numer="0."+num;
if (count==1)
{
DotIndex=num.indexOf('.');
if (num.substring(DotIndex+1).length>2)
numer=num.substring(0,DotIndex)+"."+num.substring(DotIndex+1,DotIndex+3);
else
numer=num.substring(0,DotIndex)+"."+(num+"000").substring(DotIndex+1,DotIndex+3);
}
return(numer);
}
//when click "other use",pop up a text dialog,insert another use.
function selct(my)
{
var countme=0;
for (i=0;i<my.length;i++)
{
if (my.options[i].text=="其他" && my.options[i].selected)
{
countme=1;
show(useIt1);
}
}
if (countme==0)
{
hide(useIt1);
}
}
//load current date at this format(xxxxxxxx)
function loaddate(my)
{
dt=new Date();
var y=dt.getYear().toString();
m1=dt.getMonth()+1;
if(m1<10)
var m="0"+m1;
else
var m=m1.toString();
if(dt.getDate()<10)
var d="0"+dt.getDate();
else
var d=dt.getDate().toString();
my.value=y+m+d;
}
//print the current date on the page
function printdate()
{
dt=new Date();
var y=dt.getYear().toString();
m1=dt.getMonth()+1;
if(m1<10)
var m="0"+m1;
else
var m=m1.toString();
if(dt.getDate()<10)
var d="0"+dt.getDate();
else
var d=dt.getDate().toString();
return(y+'/'+m+'/'+d);
}
//load current date at this format(xxxx/xx/xx)
function loaddate1()
{
dt=new Date();
var y=dt.getYear().toString();
m1=dt.getMonth()+1;
if(m1<10)
var m="0"+m1;
else
var m=m1.toString();
if(dt.getDate()<10)
var d="0"+dt.getDate();
else
var d=dt.getDate().toString();
var return_me=y+"/"+m+"/"+d;
return return_me;
}
//count most close date to pay interest
function count_day()
{
dt=new Date();
var current_year=dt.getYear();
var current_month=dt.getMonth()+1;
var current_day=dt.getDate();
if (current_month>=1 && current_month<3)
countday=current_year+"/03/20";
if (current_month==3)
if (current_day>20)
countday=current_year+"/06/20";
else
countday=current_year+"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -