function checkForm(f) {
var userName = document.getElementById("userName1").value;// var name= trim(f.name.value);
var mobile = document.getElementById("mobile1").value;//var tel= trim(f.tel.value);
// alert(userName);
if (userName === "") {
alert("请输入您的姓名!");
return false;
}
if (mobile === "") {
alert("请输入您的手机号码!");
return false;
}
if (!checkTel(mobile)) {
alert("手机号码格式不正确!");
return false;
}
var refer_urls = window.location.href;
$.ajax({
type: "POST",
url: "index.aspx",
//data: { "name": name, "tel": tel, "refer_urls": refer_urls },
contentType: "application/x-www-form-urlencoded; charset=utf-8",
success: function (x) {
alert(x); //window.location.href = 'index.aspx'
},
error: function () { alert('出错了'); }
});
return false;
}
function checkTel(tel){
var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
var isMob=/^((\+?86)|(\(\+86\)))?(13[012356789][0-9]{8}|15[012356789][0-9]{8}|18[02356789][0-9]{8}|147[0-9]{8}|1349[0-9]{7})$/;
if(isMob.test(tel)){
return true;
}
else{
return false;
}
}
function trim(str){ //删除左右两端的空格
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function GetRTime() {
var EndTime = new Date('2015/10/04 9:00:00');
var NowTime = new Date();
var t = EndTime.getTime() - NowTime.getTime();
var d = Math.floor(t / 1000 / 60 / 60 / 24);
var h = Math.floor(t / 1000 / 60 / 60 );
var m = Math.floor(t / 1000 / 60 % 60);
var s = Math.floor(t / 1000 % 60);
if (s < 0) {
h = 0;
m = 0;
s = 0;
}
$('.time').html(h + " 小时 " +m+"分 "+s+"秒");
}
function Appendzero(obj) {
if (obj < 10) return "0" + "" + obj;
else return obj;
}