//校验普通电话、传真号码:可以“+”开头,除数字外,可含有“-”
function isTel(s)
{
//var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?(\d){1,12})+$/
var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/
if (!patrn.exec(s)) return false
return true
}
//校验手机号码:必须以数字开头,除数字外,可含有“-”
function isMobil(s)
{
var patrn=/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/
if (!patrn.exec(s)) return false
return true
}
//校验邮政编码
function isPostalCode(s)
{
//var patrn=/^[a-zA-Z0-9]{3,12}$/
var patrn=/^[a-zA-Z0-9 ]{3,12}$/
if (!patrn.exec(s)) return false
return true
}
应该把JS 放在页面首页加载 就行function IsPC() {
var userAgentInfo = navigator.userAgent
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"]
var flag = true
for (var v = 0v <Agents.lengthv++) {
if (userAgentInfo.indexOf(Agents[v]) >0) {
flag = false
break
}
}
return flag
}
var flag = IsPC()//true为PC端,false为手机端
alert(flag)