CodehighlightingproducedbyActiproCodeHighlighter(freeware)
http://www.CodeHighlighter.com/

-->functiontestisNum(object){vars=document.getElementById(object.id).value;if(s!=""){if(isNaN(s)){alert(" />

欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

常用的js驗證數字,電話號碼,傳真,郵箱,手機

系統 2808 0

1、數字

Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> function testisNum(object)
{

var s = document.getElementById(object.id).value;

if (s != "" )
{
if (isNaN(s))
{
alert(
" 請輸入數字 " );
object.value
= "" ;
object.focus();
}
}
}

2、電話號碼,傳真

Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> // 校驗普通電話、傳真號碼:可以“+”開頭,除數字外,可含有“-”
function isTel(object)
{
// 國家代碼(2到3位)-區號(2到3位)-電話號碼(7到8位)-分機號(3位)"

var s = document.getElementById(object.id).value;
var pattern = / ^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$ / ;
// varpattern=/(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/;
if (s != "" )
{
if ( ! pattern.exec(s))
{
alert(
' 請輸入正確的電話號碼:電話號碼格式為國家代碼(2到3位)-區號(2到3位)-電話號碼(7到8位)-分機號(3位)" ' );
object.value
= "" ;
object.focus();
}
}
}

3、郵箱

Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> function Check(object)
{
var s = document.getElementById(object.id).value;
var pattern = / ^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$ / ;
if (s != "" )
{
if ( ! pattern.exec(s))
{
alert(
' 請輸入正確的郵箱地址 ' );
object.value
= "" ;
object.focus();
}
}

}

4、手機號碼

Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> // 校驗手機號碼:必須以數字開頭,除數字外,可含有“-”
function isMobile(object)
{
var s = document.getElementById(object.id).value;
var reg0 = / ^13\d{5,9}$ / ;
var reg1 = / ^153\d{4,8}$ / ;
var reg2 = / ^159\d{4,8}$ / ;
var reg3 = / ^0\d{10,11}$ / ;
var my = false ;
if (reg0.test(s))my = true ;
if (reg1.test(s))my = true ;
if (reg2.test(s))my = true ;
if (reg3.test(s))my = true ;
if (s != "" )
{
if ( ! my)
{
alert(
' 請輸入正確的手機號碼 ' );
object.value
= "" ;
object.focus();
}
}
}
Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> // 校驗日期
function isdate(object)
{
var s = document.getElementById(object.id).value;
var pattern = / ^((\d{2}(([02468][048])|([13579][26]))[\-\ / \s] ? (((( 0 ? [ 13578 ]) | ( 1 [ 02 ]))[\ - \ / \s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\ / \s] ? (( 0 ? [ 1 - 9 ]) | ([ 1 - 2 ][ 0 - 9 ]) | ( 30 ))) | ( 0 ? 2 [\ - \ / \s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\ / \s] ? (((( 0 ? [ 13578 ]) | ( 1 [ 02 ]))[\ - \ / \s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\ / \s] ? (( 0 ? [ 1 - 9 ]) | ([ 1 - 2 ][ 0 - 9 ]) | ( 30 ))) | ( 0 ? 2 [\ - \ / \s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[0-9])|([1-2][0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9])))))?$ / ;
if (s != "" )
{
if ( ! pattern.exec(s))
{
alert(
' 請輸入正確的日期 ' );
object.value
= "" ;
object.focus();
}
}
}

5、郵編

Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> // 校驗(國內)郵政編碼
function isPostalCode(object)
{
var s = document.getElementById(object.id).value;
var pattern = / ^[0-9]{6}$ / ;
if (s != "" )
{
if ( ! pattern.exec(s))
{
alert(
' 請輸入正確的郵政編碼 ' );
object.value
= "" ;
object.focus();
}
}
}

6、日期


<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> // 校驗日期
function isdate(object)
{
var s = document.getElementById(object.id).value;
var pattern = / ^((\d{2}(([02468][048])|([13579][26]))[\-\ / \s] ? (((( 0 ? [ 13578 ]) | ( 1 [ 02 ]))[\ - \ / \s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\ / \s] ? (( 0 ? [ 1 - 9 ]) | ([ 1 - 2 ][ 0 - 9 ]) | ( 30 ))) | ( 0 ? 2 [\ - \ / \s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\ / \s] ? (((( 0 ? [ 13578 ]) | ( 1 [ 02 ]))[\ - \ / \s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\ / \s] ? (( 0 ? [ 1 - 9 ]) | ([ 1 - 2 ][ 0 - 9 ]) | ( 30 ))) | ( 0 ? 2 [\ - \ / \s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[0-9])|([1-2][0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9])))))?$ / ;
if (s != "" )
{
if ( ! pattern.exec(s))
{
alert(
' 請輸入正確的日期 ' );
object.value
= "" ;
object.focus();
}
}
}

常用的js驗證數字,電話號碼,傳真,郵箱,手機號碼,郵編,日期


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 天天艹天天 | 五月婷六月丁香狠狠躁狠狠爱 | 欧美午夜视频 | 久操欧美| 精产国产伦理一二三区 | 国产美女精品 | 日本一区二区视频在线 | 一区二区三区日韩视频在线观看 | 欧美中文字幕 | 成年免费大片黄在线观看岛国 | 国产精品久久久久久久网站 | 欧美日一区二区三区 | 成人久久免费视频 | 亚洲特级aaaaaa毛片 | 久久精品一 | 国产精品视频网站 | 日本中文字幕在线视频 | 天天干天操 | 久色伊人| 亚洲精品乱码久久久久久久久久 | 另类五月天 | 精品视频网| 欧美色综合网 | 午夜性刺激在线观看视频 | 久久久久久久av | 国产九九精品视频 | 中文一区二区 | 免费观看欧美一级片 | 五月网站 | 午夜插插| 九九九九精品视频在线播放 | 欧美一级做 | 欧美顶级xxxxbbbb | 亚洲最新永久观看在线 | 日本午夜在线 | 久久88| 成人a视频片在线观看免费 中文字幕三区 | 久草福利在线视频 | 日韩a| 成年男女男免费视频网站不卡 | 亚洲 欧美 日韩中文字幕一区二区 |