document.formadd.oicq.value.substr(0,1)=="0"

解决方案 »

  1.   

    document.formadd.oicq.value.getChar(0)=="0"
      

  2.   

    不好意思搞错了.document.formadd.oicq.value.charAt(0)=="0"
      

  3.   


    if (document.formadd.oicq.value.indexOf("0")==0)
       {
        alert("QQ号码第一个数字不能为零");
                document.formadd.oicq.focus();
        return;
       }
      

  4.   

    使用证则表达式的:
    if (document.formadd.oicq.value.match(/^0/))
       {
        alert("QQ号码第一个数字不能为零");
                document.formadd.oicq.focus();
        return;
       }