Copy the code code as follows:
/*
* Function: Determine whether the email format entered by the user is correct
* Passing parameters: none
* Return value: true or false
*/
function form_check() {
var email = document.getElementById("email").value; //Get email address
//Determine whether the email format is correct
if(!/^/w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*$/.test(email)) {
alert("Email format error!");
document.getElementById("email").focus(); //Let the email text box get focus
return false;
}
return true;
}
/*
* Function: Determine whether the format of the mobile phone number entered by the user is correct
* Passing parameters: none
* Return value: true or false
*/
function checkMobile(s) {
var regu = /^[1][0-9][0-9]{9}$/;
var re = new RegExp(regu);
if (re.test(s)) {
return true;
} else {
return false;
}
}