var new_num=Math.round(txt.value*10)
var result_num=new_num/10

解决方案 »

  1.   

    function issl(txt) //折率
    { var filter=/\d{10}\.{0,1}/;
    if(filter.test(txt.value))return true;
    else
    {
    alert("折率输入错误,请输入100以下的整型数字");
    txt.value='';
    //txt.focus();
    return false;
    }
    }
    这样不对呀,不能输入小数点后的一位
      

  2.   

    Round 函数  语言参考 
    版本 2 
     请参阅 
    --------------------------------------------------------------------------------描述
    返回按指定位数进行四舍五入的数值。
    语法
    Round(expression[, numdecimalplaces])
    Round 函数的语法有以下参数:参数 描述 
    expression 必选。进行四舍五入的数值表达式。 
    numdecimalplaces 可选。数字表明小数点右边有多少位进行四舍五入。如果省略,则 Round 函数返回整数。  
      

  3.   

    晕,看错楼主的意思了
    try:
    <script language="javascript">
    function issl(txt) //折率
    {
    var filter=/^[1-9]?[0-9]?(\.\d)?$/;
    if(filter.test(txt.value))return true;
    else
    {
    alert("折率输入错误,请输入100以下的整型数字");
    txt.value='';
    //txt.focus();
    return false;
    }
    }
    </script>
    <input type="text" onblur="issl(this)">