js如何截取小数点前的数字?如
59897.232565684
想要59897
------解决方案--------------------var ab = 59897.232565684;
var ab_str = ab.toString();
var ab_num = parseInt(ab_str.substring(0,ab_str.indexOf( '. ')));
alert(ab_num);
------解决方案--------------------var i = 59897.232565684.indexOf( ". ");
59897.232565684.substring(0,i);
------解决方案--------------------double f=59897.232565684;
String fs = String.valueOf(f);
fs=fs.replaceAll( "([^\\.]+)\\.(.*) ", "$1 ");
------解决方案--------------------alert(Math.round(59897.232565684));
------解决方案--------------------alert(Math.round(59897.232565684));
正解!!!!!
------解决方案-------------------- <script language= "javascript ">
function tt(){
var ab = 59897.232565684;
var ab_str = ab.toString();
var ab_num = parseInt(ab_str.substring(0,ab_str.indexOf( '. ')));
}
</script>