日期:2014-05-17  浏览次数:20794 次

求个尾数自动改8的函数
有一些数字是自动计算出来的   现在需要个位数如果不是8的要变成8   哪位大侠帮忙给写一个?
比如  

50.12   --   58.12
124       --   128
69         --   68  
138       --   138
102.3   --   108.3  


------解决方案--------------------
<%@LANGUAGE= "VBSCRIPT " CODEPAGE= "65001 "%>
<% option explicit %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<!-- DW6 -->
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=utf-8 " />
<title> shawl.qiu template </title>
</head>
<body>
<xmp>
50.12 -- 58.12
124 -- 128
69 -- 68
138 -- 138
102.3 -- 108.3
</xmp>

<xmp>
<%

Response.Write(cDigit(54.12, 8))
Response.Write(vbcr&vbcr)
Response.Write(cDigit(58.12, 8))
Response.Write(vbcr&vbcr)
Response.Write(cDigit(50.12, 8))

function cDigit(iValue, iForChg)
dim iTemp
iTemp=cInt(iValue) Mod 10
if(iTemp <> iForChg) then iValue=iValue-iTemp+8
cDigit=iValue
end function
%>
</xmp>
</body>
</html>