document.write( "JS中的Math.ceil():
")
document.write(Math.ceil(0.60) + "
")
document.write(Math.ceil(0.40) + "
")
document.write(Math.ceil(5) + "
")
document.write(Math.ceil(5.1) + "
")
document.write(Math.ceil(-5.1) + "
")
document.write(Math.ceil(-5.9) + "
")
response.Write "
ASP用的ceil():
"
response.Write Ceil(0.60)&"
"
response.Write Ceil(0.40)&"
"
response.Write Ceil(5)&"
"
response.Write Ceil(5.1)&"
"
response.Write Ceil(-5.1)&"
"
response.Write Ceil(-5.9)&"
"
Function Ceil(inNum)
Dim nNum, tempInt
nNum = Fix(inNum)
If inNum > nNum Then
tempInt = nNum + 1
Else
tempInt = nNum
End If
Ceil = tempInt
End Function
%>
echo "
PHP用的ceil():
";
echo Ceil(0.60)."
";
echo Ceil(0.40)."
";
echo Ceil(5)."
";
echo Ceil(5.1)."
";
echo Ceil(-5.1)."
";
echo Ceil(-5.9)."
";
?>
显示结果:
JS中的Math.ceil():
1
1
5
6
-5
-5
ASP用的ceil()
1
1
5
6
-5
-5
ASP用的ceil():
"
'response.Write Ceil(0.60)&"
"
'response.Write Ceil(0.40)&"
"
'response.Write Ceil(5)&"
"
'response.Write Ceil(5.1)&"
"
'response.Write Ceil(-5.1)&"
"
'response.Write Ceil(-5.9)&"
"
'
'Function Ceil(inNum)
' Dim nNum, tempInt
' nNum = Fix(inNum)
'If inNum > nNum Then
'tempInt = nNum + 1
'Else
' tempInt = nNum
'End If
'Ceil = tempInt
'End Function
%>
PHP用的ceil():
1
1
5
6
-5
-5
分享到:更多