^0?(13)[4-9][0-9]{8}$|^(153)\d{8}$|^(156)\d{8}$|^(158)\d{8}$|^(159)\d{8}$试试这个

解决方案 »

  1.   


    function checkSjh(str)
    //手机号码
    {
    exp=/^0?1[35]\d{9}$/;
    if(str.search(exp) != -1)
    {
    return false;
    }
    return true;
    } 你少写了个1吧^0?1[35]\d{9}$
      

  2.   

    去原来的帖子看吧,search和test方法不一样,你的返回值相反了
    function checkSjh(str) 
    //手机号码 

    exp=/^0?[35]\d{9}$/; 
    if(str.search(exp) != -1) //你这个判断是正确的,你怎么就返回false??

    //return false; 
    return true; 

    return false; 
      

  3.   

    5楼说的问题正确,
    不过下面这个正则表达式对国内手机号码的匹配肯定是错误的。
    exp=/^0?[35]\d{9}$/
    它的含义是 以0头,第二位数字是3或者5,然后后面跟着0个数字的字符串。
      

  4.   

    刚刚敲错了数字。5楼说的问题正确,
    不过下面这个正则表达式对国内手机号码的匹配肯定是错误的。
    exp=/^0?[35]\d{9}$/
    它的含义是 以0头,第二位数字是3或者5,然后后面跟着9个数字的字符串。 
      

  5.   

    国内手机正则: var   reg=/(^0{0,1}1[3|5][0-9]{9}$)/;
      

  6.   

    8楼的正则表达式不正确。
    例如: 1|123456789
    这样 第二位数字把 “|”作为合法输入了。 可以改为
    var  reg=/(^0{0,1}1(3|5)[0-9]{9}$)/;或者像下面这样,更简单一些。
    var  reg=/^0?1[35]\d{9}$/;
      

  7.   

    把menuSelectY改进了一下,这回
    可以支持IE和FF了。
    function menuSelectY(event, menuIndex){
    var e = event || window.event;
    var obj = document.getElementById("item" + menuIndex); if(navigator.userAgent.indexOf("MSIE")>0){
    if( e.toElement != obj && e.toElement.parentNode != obj && obj.className=="itemDisplayON" ){
    obj.className="itemDisplayOFF";
    }
    } else {
    if( e.relatedTarget.parentNode != obj && e.target.parentNode != obj && obj.className=="itemDisplayON" ){
    obj.className="itemDisplayOFF";
    }
    }
    }
      

  8.   

    SORRY, 10楼的帖子发错地方了。