精品国产免费观看久久久_久久天天躁狠狠躁夜夜爽_无码人妻少妇久久中文字幕_狠狠做深爱婷婷久久综合一区

網絡建站知識

精準傳達 ? 價值共享

洞悉互聯網前沿資訊,探尋網站營銷規律

查看其它板塊

js判斷手機號和姓名

作者:Smileby陌少羽 | 2019-05-17 14:45 |點擊:

直接貼出源代碼給大家參考


在其下面添加如下代碼:
 
  1.  <script type="text/javascript">
                    function CheckSubmit2() {
                        var myreg2 = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                        var tel2 = document.getElementById("tel2").value;
                        var body2 = document.getElementById("body2").value;
                        if (tel2 == "") {
                            alert('請輸入您的手機!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (tel2 == "請輸入您的手機號") {
                            alert('請輸入您的手機!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (tel2.length != 11) {
                            alert('請輸入有效的手機號碼!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (!myreg.test(tel2)) {
                            alert('請輸入有效的手機號碼!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (body2 == "") {
                            alert('請輸入專利名稱!');
                            document.form2.body2.focus();
                            return false;
                        }
                        else if (body2 == "請輸入專利名稱,如:生物基因庫") {
                            alert('請輸入專利名稱!');
                            document.form2.body2.focus();
                            return false;
                        }
                        else {
                            return true;
                        }
                    }
                </script>
 
下面貼上完整代碼

 
  1.  <form id="form2" name="form2" method="post" onsubmit="return CheckSubmit2();" action="/">
                <input value="專利申請" type="hidden" id="titles2" name="titles2">
                <input value="/index.html" type="hidden" id="url2" name="url2">
                <div class="sbfwc" data-scroll-reveal="enter bottom and move 40px over 0.3s">
                    <h6>
                        <span>專利<b>免費</b>檢索</span>防止專利侵權 提高授權成功率</h6>
                    <div class="sbfwc_a fr">
                        <input id="body2" name="body2" maxlength="30" class="sbmc" type="text" value="請輸入專利名稱,如:生物基因庫" onfocus="if(value=='請輸入專利名稱,如:生物基因庫') {value=''}" onblur="if (value=='') {value='請輸入專利名稱,如:生物基因庫'}">
                        <input id="tel2" name="tel2" maxlength="11" class="sbsjh" type="text" value="請輸入您的手機號" onfocus="if(value=='請輸入您的手機號') {value=''}" onblur="if (value=='') {value='請輸入您的手機號'}">
                        <input class="huifu" type="submit" value="30s速回服務">
                    </div>
                    <div class="clearfix">
                    </div>
                </div>
                </form>
                <script type="text/javascript">
                    function CheckSubmit2() {
                        var myreg2 = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                        var tel2 = document.getElementById("tel2").value;
                        var body2 = document.getElementById("body2").value;
                        if (tel2 == "") {
                            alert('請輸入您的手機!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (tel2 == "請輸入您的手機號") {
                            alert('請輸入您的手機!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (tel2.length != 11) {
                            alert('請輸入有效的手機號碼!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (!myreg.test(tel2)) {
                            alert('請輸入有效的手機號碼!');
                            document.form2.tel2.focus();
                            return false;
                        }
                        else if (body2 == "") {
                            alert('請輸入專利名稱!');
                            document.form2.body2.focus();
                            return false;
                        }
                        else if (body2 == "請輸入專利名稱,如:生物基因庫") {
                            alert('請輸入專利名稱!');
                            document.form2.body2.focus();
                            return false;
                        }
                        else {
                            return true;
                        }
                    }
                </script>
 
 

其中body2和tel2需要改成你自己的
 
           
如沒特殊注明,文章均為狐靈科技原創,轉載請注明?? "js判斷手機號和姓名
多一份免費策劃方案,總有益處。

請直接添加技術總監微信聯系咨詢

網站設計 品牌營銷

多一份參考,總有益處

聯系狐靈科技,免費獲得專屬《策劃方案》及報價

咨詢相關問題或預約面談,可以通過以下方式與我們聯系

業務熱線:15082661954 / 大客戶專線:15523356218