function myF1(parmA)
{
     return parmA*1
}//字符型转成数值型,就:parm*1
//数值型转成字符型,就:parm+""

解决方案 »

  1.   

    parseInt("string")
    parseFloat("string")
      

  2.   

    增怎样判断变量类型为int型,万分感谢各位了
      

  3.   

    我的函数如下:
    function isLeapYear(iYear)
     {
      var iYear=parseInt(iYear);
      alert(iYear);
        return ( ! ( ( iYear % 4 ) == 0 ) && ( ( iYear % 100 ) == 0 ) )|| ! ( ( iYear % 400 ) == 0 );
     }
    可是iYear="2003"时,仍返回true;不知是哪儿错了。
    感谢帮助!
      

  4.   

    <html><head><script>
    function check()
    {
      if(!isNaN(f1.t1.value)){alert("")}
    }
    </script>
    </head><body><form name=f1 method="POST" action="--WEBBOT-SELF--">
      
      <p><input type="text" name="t1" size="20"><input type="button" value="按钮" name="B1" onclick="check()"></p>
    </form></body></html>
      

  5.   


    <script>
    function isLeapYear(iYear)
     {
      var iYear=parseInt(iYear);
      alert(iYear);
        return ( ( ( iYear % 4 ) == 0 ) && ( ( iYear % 100 ) != 0 ) )|| ( ( iYear % 400 ) == 0 );
     }
     alert(isLeapYear(2003));
     </script>
    常识也忘了吗