JS电话、手机号码验证

  function isTelephone(inpurStr) {
            var partten = /^0(([1,2]\d)|([3-9]\d{2}))-\d{7,8}$/;
            if (partten.test(inpurStr)) {
                return true;
            }
            else {
                return false;
            }
        }

        function isMobile(inputString) {
            var partten = /^1[3,5,8]\d{9}$/;
            var fl = false;
            if (partten.test(inputString)) {
                return true;
            }
            else {
                //alert('不是手机号码');
                return false;
            }
        }

posted @ 2013-08-05 09:31  chengeng  阅读(590)  评论(0编辑  收藏  举报