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
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.
str=replace(str, "," ,"")
str=replace(str, "." ,"")
if isnumeric(str) then
response.write "bara siffror"
else
response.write "inte bara siffror"
end if