<!doctype html>
<meta charset= "UTF-8"/>
<title> Login </title>
<link rel= "stylesheet" type= "Text/css" href= "Css/login.css" >
<script type= "Text/javascript" src= "/js/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, it means the countdown is not over.
if (second>0) {
$ ("#getCode"). Text (second);
$ ("#getCode"). CSS ("Background", "#677377");
The contents of the button appear in a countdown state
$ ("#getCode"). attr ("Disabled", true);
Time minus one.
second--;
Repeat after one second
SetTimeout (function () {countdown (second);},1000);
Otherwise, the button resets to the initial state
}else{
The content in the button is restored to its original state
$ ("#getCode"). Text ("Get Verification Code");
$ ("#getCode"). CSS ("Background", "" ");
button is not in the click state
$ ("#getCode"). attr ("disabled", false);
}
}
$ (function () {
Click the login button
$ ("#login"). Click (function () {
var Contactsphone = $ ("input[name= ' Membertel ')"). Val ();
if (Contactsphone = = NULL | | contactsphone = = "") {
Alert ("Please fill in the phone number");
Return
}
if (contactsphone.length! = 11) {
Alert ("Please fill in the correct phone number");
Return
}
var Validatecode = $ ("#validateCode"). Val ();
if (Validatecode = = NULL | | validatecode = = "") {
Alert ("Please enter the verification Code");
Return
}
var phoneuuid = "abcdef";//Add a 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 ("Captcha error");
} 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 = = ' car ') {
Location.href = "send.html";
} else {
Location.href = "index.html";
}
}
}
},
"Text"
);
});
Get Verification Code
$ ("#getCode"). Click (function () {
var Contactsphone = $ ("input[name= ' Membertel ')"). Val ();
if (Contactsphone = = NULL | | contactsphone = = "") {
Alert ("Please fill in the phone number");
Return
}
if (contactsphone.length! = 11) {
Alert ("Please fill in the correct phone number");
Return
}
var phoneuuid = "abcdef";//Add a 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 ("Send Success");
}else{
Alert ("Send Failed");
}
}
},
"Text"
);
Countdown (30);
});
});
</script>
<body>
<div class= "Number" >
<a></a>
<input name= "Membertel" type= "tel" placeholder= "mobile number Login" >
<button id= "GetCode" > Get Verification Code </button>
</div>
<div class= "Number" >
<a></a>
<input id= "Validatecode" type= "tel" placeholder= "Please Enter verification code" >
</div>
<button class= "Login" id= "login" > Login </button>
<p class= "P_bottom" >?banjingquan.com</p>
</body>
The first page of the HTML5. Login Plus Countdown