实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <title>Math Object Rounding Example</title>
5
    <script type="text/javascript">
6
    
7
        alert(Math.ceil(25.9));     //26
8
        alert(Math.ceil(25.5));     //26
9
        alert(Math.ceil(25.1));     //26
10
        
11
        alert(Math.round(25.9));    //26
12
        alert(Math.round(25.5));    //26
13
        alert(Math.round(25.1));    //25
14
                
15
        alert(Math.floor(25.9));    //25
16
        alert(Math.floor(25.5));    //25
17
        alert(Math.floor(25.1));    //25
18
        
19
    </script>
20
</head>
21
<body>
22
23
</body>
24
</html>