日期:2011-09-16  浏览次数:21227 次

以下是源代码:
function formatcur(cur,v)
  dim curd
  if instr(cur,".")>0 then
  curd = split(cur,".")(1)
  cur = split(cur,".")(0)
  else
  curd = "00"
  end if
if v=0 then
    if cur=0 then
 formatcur="<font color=’#cccccc’>-</font>"
 else
v9=cur&""
va=len(v9)
if va<4 then
v2=v9
else
yi=Fix(va/3)
y2=(yi+1)*3
t1=3-(y2-va)+1
if yi<>va/3 then
e2=""
for i=1 to yi
v2=","&Mid(v9,t1+3*(i-1),3)
e2=e2+v2
next
v2=Mid(v9,1,(va-3*yi))&e2
else
e2=""
for y=2 to yi
v2=","&Mid(v9,(y-1)*3+1,3)
e2=e2+v2
next
v2=Mid(v9,1,3)&e2
end if
end if
 formatcur=v2
 end if
else
    if cur=0 then
 formatcur="<font color=’#cccccc’>-</font>"
 else
 formatcur=FormatCurrency(cur)
 end if
end if
if curd<>"" and cur<>0 then
 if len(curd)<2 then
  curd = curd & "0"
 end if
 formatcur = formatcur & "." & curd
end if
end function