Dim icq
icq = Request.Form("icq")
If Not barasiffror(icq) Then
Response.Write "ICQ får bara innehålla SIFFROR!!!!"
End If
Function barasiffror(strText)
Dim i
For i = 1 To Len(strText)
If Instr("0123456789", Mid(strText, i, 1)) = 0 Then
barasiffror = false
exit function
End If
Next
barasiffror = true
End Function
------------------
/bohlin
kaffe är djävulens dryck
glögg är guds dryck
nu förstår jag inte riktigt vad du gjort i funktionen, bohlin, men jag brukar alltid använda isnumeric()...
if isnumeric(sträng) then
response.write "bara siffror"
else
response.write "inte bara siffror"
end if
sen är det dock lite vanskligt att göra en 'endastsiffror' koll på ett postnummer, eftersom jag och många, många andra skriver med mellanslag efter de tre första siffrorna.
capisce? ;)
------------------
<A HREF="http://cartman.nu" TARGET=_blank>
where do you want to go to die?</A>
str=replace(str, "," ,"")
str=replace(str, "." ,"")
if isnumeric(str) then
response.write "bara siffror"
else
response.write "inte bara siffror"
end if
kortare än din kod... ;)
------------------
<A HREF="http://cartman.nu" TARGET=_blank>
where do you want to go to die?</A>