Html5 first page. Login and countdown, html5 countdown
<! Doctype html>
<Html lang = "en">
<Head>
<Meta charset = "UTF-8"/>
<Title> logon </title>
<Link rel = "stylesheet" type = "text/css" href = "css/login.css">
<Script type = "text/javascript" src = "/javascript/jquery-1.4.2.min.js"> </script>
<Script type = "text/javascript" src = "/js/jquery. cookie. js"> </script>
<Script type = "text/javascript" src = "/js/param. js"> </script>
<Script type = "text/javascript">
Function countDown (second ){
// If the number of seconds is greater than 0, the countdown is not over yet
If (second> 0 ){
$ ("# GetCode"). text (second );
$ ("# GetCode" ).css ("background", "#677377 ");
// The content in the button is displayed in the countdown status.
$ ("# GetCode"). attr ("disabled", true );
// Minus one time
Second --;
// Repeat the execution one second later
SetTimeout (function () {countDown (second) ;}, 1000 );
// Otherwise, the button is reset to the initial state
} Else {
// Restore the content in the button to its initial state
$ ("# GetCode"). text ("Get Verification Code ");
$ ("# GetCode" ).css ("background ","");
// Click the button to set the unclickable status
$ ("# GetCode"). attr ("disabled", false );
}
}
$ (Function (){
// Click the logon button.
$ ("# Login"). click (function (){
Var contactsPhone = $ ("input [name = 'membertel']"). val ();
If (contactsPhone = null | contactsPhone = ""){
Alert ("Please enter your mobile phone number ");
Return;
}
If (contactsPhone. length! = 11 ){
Alert ("enter the correct mobile phone number ");
Return;
}
Var validateCode = $ ("# validateCode"). val ();
If (validateCode = null | validateCode = ""){
Alert ("Enter the Verification Code ");
Return;
}
Var phoneUuid = "abcdef"; // Add the specified push id
Var actionUrl = "http: // 192.168.0.112: 8080/member/checkPC. action ";
$. Post (actionUrl,
{
CheckPhoneCode_phone: contactsPhone,
CheckPhoneCode_code: validateCode,
CheckPhoneCode_uuId: phoneUuid
},
Function (result ){
If (result! = Null & result! = ''){
If (result = 'phone _ error '){
Alert ("please obtain the verification code first ");
} Else if (result = 'Code _ error '){
Alert ("Incorrect verification code ");
} Else if (result = 'time _ out '){
Alert ("connection timeout ");
} Else if (result = 'Member _ close '){
Alert ("This member has been closed ");
} Else {
Var jsonResult = eval ("(" + result + ")");
$. Cookie ("member_id", jsonResult. id, {expires: 7 });
Var sourcePage = $. request. queryString ["sourcePage"];
If (sourcePage = 'Mine '){
Location. href = "mine.html ";
} Else if (sourcePage = 'cart '){
Location. href = "send.html ";
} Else {
Location. href = "index.html ";
}
}
}
},
"Text"
);
});
// Obtain the verification code
$ ("# GetCode"). click (function (){
Var contactsPhone = $ ("input [name = 'membertel']"). val ();
If (contactsPhone = null | contactsPhone = ""){
Alert ("Please enter your mobile phone number ");
Return;
}
If (contactsPhone. length! = 11 ){
Alert ("enter the correct mobile phone number ");
Return;
}
Var phoneUuid = "abcdef"; // Add the specified push id
Var actionUrl = "http: // 192.168.0.112: 8080/member/sendSMS. action ";
$. Post (actionUrl,
{
SendSMSCode_phone: contactsPhone,
SendSMSCode_phone_uuId: phoneUuid
},
Function (result ){
If (result! = Null & result! = ''){
Alert (result );
If (result = 'sendsms _ SUCCESS '){
Alert ("sent successfully ");
} Else {
Alert ("failed to send ");
}
}
},
"Text"
);
CountDown (30 );
});
});
</Script>
</Head>
<Body>
<Div class = "number">
<A> </a>
<Input name = "memberTel" type = "tel" placeholder = "mobile phone number Logon">
<Button id = "getCode"> Get Verification Code </button>
</Div>
<Div class = "number">
<A> </a>
<Input id = "validateCode" type = "tel" placeholder = "Enter the verification code">
</Div>
<Button class = "login" id = "login"> log on </button>
<P class = "p_bottom"> banjingquan.com </p>
</Body>
</Html>