Function BeaufortSkala(msek) if (msek>"0.02") and (msek<"0.2") then BeaufortSkala="Stille" if (msek>"0.3") and (msek<"1.5") then BeaufortSkala="Næsten stille" if (msek>"1.6") and (msek<"3.3") then BeaufortSkala="Svag vind" if (msek>"3.4") and (msek<"5.4") then BeaufortSkala="Let vind" if (msek>"5.5") and (msek<"7.9") then BeaufortSkala="Jævn vind" if (msek>"8.0") and (msek<"10.7") then BeaufortSkala="Frisk vind" if (msek>"10.8") and (msek<"13.8") then BeaufortSkala="Hård vind" if (msek>"13.9") and (msek<"17.1") then BeaufortSkala="Stiv kuling" if (msek>"17.2") and (msek<"20.7") then BeaufortSkala="Hård kuling" if (msek>"20.8") and (msek<"24.4") then BeaufortSkala="Stormende kuling" if (msek>"24.5") and (msek<"28.4") then BeaufortSkala="Storm" if (msek>"28.5") and (msek<"32.6") then BeaufortSkala="Stærk storm" if (msek>"32.7") and (msek<"50.0") then BeaufortSkala="Orkan"
end function
jeg sender en streng ind - men det der bliver returneret er forkert ?
Nej windscape, det er ligemeget - det skal være en string når der er komma i :-) Jeg har lige testet denne her og det virker glimrende, har rettet det hele til ElseIf.
<% Function BeaufortSkala(msek)
if (msek > "0.02") and (msek < "0.2") then BeaufortSkala="Stille" ElseIf (msek>"0.3") and (msek<"1.5") then BeaufortSkala="Næsten stille" ElseIf (msek>"1.6") and (msek<"3.3") then BeaufortSkala="Svag vind" ElseIf (msek>"3.4") and (msek<"5.4") then BeaufortSkala="Let vind" ElseIf (msek>"5.5") and (msek<"7.9") then BeaufortSkala="Jævn vind" ElseIf (msek>"8.0") and (msek<"10.7") then BeaufortSkala="Frisk vind" ElseIf (msek>"10.8") and (msek<"13.8") then BeaufortSkala="Hård vind" ElseIf (msek>"13.9") and (msek<"17.1") then BeaufortSkala="Stiv kuling" ElseIf (msek>"17.2") and (msek<"20.7") then BeaufortSkala="Hård kuling" ElseIf (msek>"20.8") and (msek<"24.4") then BeaufortSkala="Stormende kuling" ElseIf (msek>"24.5") and (msek<"28.4") then BeaufortSkala="Storm" ElseIf (msek>"28.5") and (msek<"32.6") then BeaufortSkala="Stærk storm" ElseIf (msek>"32.7") and (msek<"50.0") then BeaufortSkala="Orkan" End If
Function BeaufortSkala(msek) msek=trim(msek) if len(msek)=3 then msek="0"+msek if (msek < "00.2") then BeaufortSkala="Stille" ElseIf (msek>"00.3") and (msek<"01.5") then BeaufortSkala="Næsten stille" ElseIf (msek>"01.6") and (msek<"03.3") then BeaufortSkala="Svag vind" ElseIf (msek>"03.4") and (msek<"05.4") then BeaufortSkala="Let vind" ElseIf (msek>"05.5") and (msek<"07.9") then BeaufortSkala="Jævn vind" ElseIf (msek>"08.0") and (msek<"10.7") then BeaufortSkala="Frisk vind" ElseIf (msek>"10.8") and (msek<"13.8") then BeaufortSkala="Hård vind" ElseIf (msek>"13.9") and (msek<"17.1") then BeaufortSkala="Stiv kuling" ElseIf (msek>"17.2") and (msek<"20.7") then BeaufortSkala="Hård kuling" ElseIf (msek>"20.8") and (msek<"24.4") then BeaufortSkala="Stormende kuling" ElseIf (msek>"24.5") and (msek<"28.4") then BeaufortSkala="Storm" ElseIf (msek>"28.5") and (msek<"32.6") then BeaufortSkala="Stærk storm" ElseIf (msek>"32.7") then BeaufortSkala="Orkan" End If end function
Function BeaufortSkala(msek) msek=trim(msek) if len(msek)=3 then msek="0"+msek if (msek < "00.2") then BeaufortSkala="Stille" ElseIf (msek>="00.3") and (msek<="01.5") then BeaufortSkala="Næsten stille" ElseIf (msek>="01.6") and (msek<="03.3") then BeaufortSkala="Svag vind" ElseIf (msek>="03.4") and (msek<="05.4") then BeaufortSkala="Let vind" ElseIf (msek>="05.5") and (msek<="07.9") then BeaufortSkala="Jævn vind" ElseIf (msek>="08.0") and (msek<="10.7") then BeaufortSkala="Frisk vind" ElseIf (msek>="10.8") and (msek<="13.8") then BeaufortSkala="Hård vind" ElseIf (msek>="13.9") and (msek<="17.1") then BeaufortSkala="Stiv kuling" ElseIf (msek>="17.2") and (msek<="20.7") then BeaufortSkala="Hård kuling" ElseIf (msek>="20.8") and (msek<="24.4") then BeaufortSkala="Stormende kuling" ElseIf (msek>="24.5") and (msek<"28.4") then BeaufortSkala="Storm" ElseIf (msek>="28.5") and (msek<="32.6") then BeaufortSkala="Stærk storm" ElseIf (msek>="32.7") then BeaufortSkala="Orkan" End If end function
Aldrig 10.71 ? Ja. det siger du idag ;) Men da løsning, hvor 10.71 også virker er simplere, så synes jeg vi skal tage dem med. Jeg ved ikke nok om din skala til at vide og der skal stå <= i stedet for < som jeg har anført. I givet fald skal du vel ændre alle steder.
Function BeaufortSkala(msek) Dim m m = CDbl(msek)
if m < 0.2 then BeaufortSkala="Stille" ElseIf m<1.5 then BeaufortSkala="Næsten stille" ElseIf m<3.3 then BeaufortSkala="Svag vind" ElseIf m<5.4 then BeaufortSkala="Let vind" ElseIf m<7.9 then BeaufortSkala="Jævn vind" ElseIf m<10.7 then BeaufortSkala="Frisk vind" ElseIf m<13.8 then BeaufortSkala="Hård vind" ElseIf m<17.1 then BeaufortSkala="Stiv kuling" ElseIf m<20.7 then BeaufortSkala="Hård kuling" ElseIf m<24.4 then BeaufortSkala="Stormende kuling" ElseIf m<28.4 then BeaufortSkala="Storm" ElseIf m<32.6 then BeaufortSkala="Stærk storm" Else BeaufortSkala="Orkan" End If
Function BeaufortSkala(msek) Dim m m = CDbl(replace(msek,".",","))
if m < 0.2 then BeaufortSkala="Stille" ElseIf m<1.6 then BeaufortSkala="Næsten stille" ElseIf m<3.4 then BeaufortSkala="Svag vind" ElseIf m<5.5 then BeaufortSkala="Let vind" ElseIf m<8.0 then BeaufortSkala="Jævn vind" ElseIf m<10.8 then BeaufortSkala="Frisk vind" ElseIf m<13.9 then BeaufortSkala="Hård vind" ElseIf m<17.2 then BeaufortSkala="Stiv kuling" ElseIf m<20.8 then BeaufortSkala="Hård kuling" ElseIf m<24.5 then BeaufortSkala="Stormende kuling" ElseIf m<28.5 then BeaufortSkala="Storm" ElseIf m<32.7 then BeaufortSkala="Stærk storm" Else BeaufortSkala="Orkan" End If
End Function
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.