JS Math的用法收集

  <SCRIPT language=javascript>

<!--  

function test()

{

        document.write(Math.floor(5.80) + "<br>");//取整或下舍入

        document.write(Math.round(5.80) + "<br>");//四舍五入

        document.write(Math.ceil(5.10) + "<br>");//上舍入

        document.write(Math.abs(-5.80) + "<br>");//取绝对值

        document.write(Math.max(55,58) + "<br>");//返回两个值中最大数

        document.write(Math.min(55,58) + "<br>");//返回两个值中最小数

}

-->

</SCRIPT>

<div><script>test();</script></div>

posted @ 2011-08-23 09:20  web开发  阅读(410)  评论(0编辑  收藏  举报