zoukankan      html  css  js  c++  java
  • JavaScript判断数字

      function cTrim(sInputString,iType)
                 {
        var sTmpStr = ' '
        var i = -1
        if(iType == 0 || iType == 1)
        {
         while(sTmpStr == ' ')
         {
          ++i
          sTmpStr = sInputString.substr(i,1)
         }
         sInputString = sInputString.substring(i)
        }
        if(iType == 0 || iType == 2)
        {
         sTmpStr = ' '
         i = sInputString.length
         while(sTmpStr == ' ')
         {
          --i
          sTmpStr = sInputString.substr(i,1)
         }
         sInputString = sInputString.substring(0,i+1)
        }
        return sInputString;
                 }


    if (isNaN(docform.txtFaultFirstEliminateTimes.value)==true || cTrim(docform.txtFaultFirstEliminateTimes.value,0)=="")

    {

    alert("只能是数字");
     

    return ;

    }

  • 相关阅读:
    ajax全套
    url设计规范
    内置下划线方法
    rest_framework视图
    rest_framework
    数据库设置
    HDU 6231
    HDU 6242
    CodeForces 546D
    CodeForces 940E
  • 原文地址:https://www.cnblogs.com/xh831213/p/327251.html
Copyright © 2011-2022 走看看