小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

js驗(yàn)證文本框只能輸入手機(jī)號(hào)和電話號(hào)

 悟靜 2012-02-01
<script type="text/javascript">
        function yanzheng()
        {
            var a=document.getElementById("TextBox2");
            if(a.value=="")
            {
                alert('請(qǐng)輸入貨物名稱(chēng)!');
                a.focus();
               return false;
            }
            var c=document.getElementById("Jsm2tbShowButton");
            if(c.value=="請(qǐng)選擇 ?。校h")
            {
                alert('請(qǐng)選擇出發(fā)地!');
                c.focus();
                return false;
            }
            var d=document.getElementById("TextBox4");
            var d1=document.getElementById("TextBox5");
            if((d.value=="")&&(d1.value==""))
            {
                alert('請(qǐng)完善貨量信息!');
                d.focus();
                return false;
            }
            if(d.value!="")
            {
                var ff=d.value;
                for(var i=0;i<ff.length;i++)
                {
                    if(ff.charAt(i)<'0'||ff.charAt(i)>'9')
                    {
                        alert('貨物重量只能輸入數(shù)字!');
                        d.focus();
                        return false;
                    }
                }
            }
            var f=document.getElementById("TextBox6");
            if(f.value=="")
            {
                alert('請(qǐng)輸入貨物數(shù)量!');
                f.focus();
                return false;
            }
             var d=document.getElementById("Jsm21tbShowButton");
            if(d.value=="請(qǐng)選擇 ?。校h")
            {
                alert('請(qǐng)選擇目的地!');
                d.focus();
                return false;
            }
            var flag = "";
            var radioList=document.getElementById("CheckBoxList1");
            var inarr = radioList.getElementsByTagName('input');
            for (var i=0; i<inarr.length; i++)
            {
                if(inarr[i].type=="checkbox")
                 {
                    if(inarr[i].checked==true)   
                     {
                         flag = "ccc";
                     }
                  }
             }
             if(flag=="")
             {
                alert('請(qǐng)選擇貨運(yùn)形式!');
                return false;
             }
             var e=document.getElementById("texttime");
            if(e.value=="")
            {
                alert('請(qǐng)選擇截止日期!');
                e.focus();
                return false;
            }
            else
            {
                var nowdate = new Date();
                var mon=nowdate.getMonth();
                var months=mon+1;
                if(CompareDate2(nowdate.getFullYear(),months,nowdate.getDate(),e.value))
                {
                    alert('截止時(shí)間需大于等于當(dāng)前日期!');
                    e.focus();
                    return false;
                }
            }
            var g=document.getElementById("TextBox7");
            if(g.value=="")
            {
                alert('請(qǐng)輸入聯(lián)系人!');
                g.focus();
                return false;
            }
            var h=document.getElementById("TextBox8");
            if(h.value=="")
            {
                alert('請(qǐng)輸入聯(lián)系電話!');
                h.focus();
                return false;
            }
            else
            {
                var reg = /^(\d{3,4})-(\d{7,8})/;//驗(yàn)證電話號(hào)碼
                var regph=/[1][3-9][0-9]{9,9}/;//驗(yàn)證手機(jī)號(hào)碼
                if(h.value.constructor===String)
                {
                    var re=h.value.match(reg);
                    var reph=h.value.match(regph);
                    if(re==null&&reph==null)//只能輸入正確格式的手機(jī)或電話號(hào)碼
                    {
                        alert('聯(lián)系方式格式有誤!');
                        h.focus();
                        return false;
                    }
                }
            }
            return true;
        }
        function CompareDate2(ny,nm,nd,n2)
        {
            var panduan=false;
            var t1=new Date(ny+'/'+nm+'/'+nd);
            var arr2=n2.split('-');
            var t2=new Date(arr2[0]+'/'+arr2[1]+'/'+arr2[2]);
            if(t1>t2)
            {
                panduan=true;
            }
            return panduan;
        }
    </script>

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類(lèi)似文章 更多