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>