1.字符串截取法 function get(){ var s = 22.127456 + ""; var str = s.substring(0,s.indexOf(".") + 3); alert(str);} 2. 正则表达式效果不错 <script type="text/javascript"> onload = function(){ var a = "23.456322"; …
if (!isNumeric(fm.ChangeFee.value)) { alert("请输入正确的变更费用"); document.getElementsByName('ChangeFee')[0].style.borderColor = "#f64f4f"; return false; } var string = fm.ChangeFee.value.toString(); var index = string.indexOf(".");…