Håller på och plockar lite med funktioner.
Är detta ungefär rätt? :OO
function howMany(antal)
dim HTMLkod
antal=cint(antal)
if antal=0 Then
HTMLkod="<font color=blue>"
Response.Write HTMLkod
elseif antal>8 Then
HTMLkod="<font color=red>"
Response.Write HTMLkod
else
HTMLkod="<font color=yellow>"
Response.Write HTMLkod
end if
end function
På sidan så anropar jag med tex:
<%=howMany(5)%>
Kan man göre på dette vis?
Sitter med en asp-bok med den har inte så mycket att komma med...
Är scriplets att föredra?
Jo, du kan göra så, men jag tycker att du inte skall ha response.write i funktionen
function howMany(antal)
antal=cint(antal)
if antal=0 Then
howMany="<font color=blue>"
elseif antal>8 Then
howMany="<font color=red>"
else
howMany="<font color=yellow>"
end if
end function
response.write howMany(5)
------------------ essentitia preter non sans multiplicandum
Hmmm... :q
Ok, då får jag läsa på lite.
Men sub, det är väl bara till för att "skickas" i koden på en sida, de kan väl inte returnera något!?! Correct me...