现在的位置: 首页 > 综合 > 正文

js 计算时注意事项

2018年05月14日 ⁄ 综合 ⁄ 共 297字 ⁄ 字号 评论关闭

一、计算时注意事项

javascript  中  运用到计算一定要注意  类型转换:

          1. parseFloat(price*number_value).toFixed(2);

          2.toFixed(2);保留小数点

二、处理只读

    设置为只读:document.getElementById("sl"+indexNum).setAttribute("readonly", "readonly");

    设置为可输:$("#sl"+indexNum).removeAttr("readonly");//把只读的属性删除了

三、整数相加

     pageNum = parseInt(pageNum)+1;

抱歉!评论已关闭.