if(isNaN(value)){
//不全为数字
}else{
//全是数字
}
其中:value是你要检查的表单输入的值
isNaN  的意思就是 is Not a Number

解决方案 »

  1.   

    <Html>
    <Head>
    <Script Language="JavaScript">
      Function checkData()
      {
         if (isAllNumber(Document.abc.t1.value))
           {
              Alert("\对不起,你所输入的数据不能全部对数字!");
              return false;
            }
         if (isRright(Document.abc.t1.value))
           {
              Alert("\对不起,你所输入的数据中1-4位必须位汉字或者字母!");
              return false;
           }
          return true;
      }
      Function isAllNumber(str)
      {
         strNumber="0123456789"
         For(int i=0;i<str.length;i++)
         {
            temp=substring(str,i,i+1)
            if(strNumber.indexOf(temp,0)==-1) 
               return false;
         }
         return true;
      }
    </Script>
    </Head>
    <Body>
      <Form name="abc" action="" method="post" onsubmit="Return checkData();">
      <INPUT type="text" name="t1" size="20">
       .......
      </Form>
    </Body>
    </Html>
      

  2.   

    不对啊,老大,提示:
    temp=substring(str,i,i+1)
    缺少对象
      

  3.   

    <input NAME="nickname" style="border:1px #91908D solid" size=13  onkeyup="value=value.replace(/[^\u4E00-\u9FA50-9a-zA-Z]{1,4}/g,'')" onpaste="return false">我想这样控制1-4个输入,可是却不行,望 指教!!