N
neptune6644
I'm having trouble getting the following function to return a value,
unless I add a response.write to the end of the function. Calling the
function will not get the value to appear.
<%
Dim strMyVar1, strMyVar2, poop
strMyVar1 = 75.5
strMyVar2 = 5.5
'----------------------------------------------------------------------------------------
'Why isn't this displaying a returned value?!?
'----------------------------------------------------------------------------------------
Response.Write per_to_dec(strMyVar1) & "<br>"
FUNCTION per_to_dec(poop)
if len(poop) = 1 then
poop = ".0" & strPer_to_Dec
end if
'ex. 47%
if len(poop) = 2 then
poop = "." & poop
end if
'ex 1.5%
if len(poop) = 3 AND mid(poop,2,1) = "." then
poop = Replace(poop,".","")
poop = ".0" & poop
end if
'ex. 1.75% or 17.5%
if len(poop) = 4 then
if mid(poop,2,1) = "." then
poop = Replace(poop,".","")
poop = ".0" & poop
elseif mid(poop,3,1) = "." then
poop = Replace(poop,".","")
poop = "." & poop
end if
end if
'ex. 10.75%
if len(poop) = 5 then
poop = Replace(poop,".","")
poop = "." & poop
end if
'----------------------------------------------------------------------------------------
'This is the only way this function will display a returned value
'----------------------------------------------------------------------------------------
response.write poop
END FUNCTION
%>
What am I doing wrong?
Thanks.
unless I add a response.write to the end of the function. Calling the
function will not get the value to appear.
<%
Dim strMyVar1, strMyVar2, poop
strMyVar1 = 75.5
strMyVar2 = 5.5
'----------------------------------------------------------------------------------------
'Why isn't this displaying a returned value?!?
'----------------------------------------------------------------------------------------
Response.Write per_to_dec(strMyVar1) & "<br>"
FUNCTION per_to_dec(poop)
if len(poop) = 1 then
poop = ".0" & strPer_to_Dec
end if
'ex. 47%
if len(poop) = 2 then
poop = "." & poop
end if
'ex 1.5%
if len(poop) = 3 AND mid(poop,2,1) = "." then
poop = Replace(poop,".","")
poop = ".0" & poop
end if
'ex. 1.75% or 17.5%
if len(poop) = 4 then
if mid(poop,2,1) = "." then
poop = Replace(poop,".","")
poop = ".0" & poop
elseif mid(poop,3,1) = "." then
poop = Replace(poop,".","")
poop = "." & poop
end if
end if
'ex. 10.75%
if len(poop) = 5 then
poop = Replace(poop,".","")
poop = "." & poop
end if
'----------------------------------------------------------------------------------------
'This is the only way this function will display a returned value
'----------------------------------------------------------------------------------------
response.write poop
END FUNCTION
%>
What am I doing wrong?
Thanks.