txtemail 문자열에서 Instr 함수를 이용, 해당되는 문자 "@", "." 가 있나 없나, 문자열 길이가 7보다 작은가를

체크해서 유효한 이메일 인지를 검사합니다. 닷넷의 경우는 RegularExpressionValidator 컨트롤을 사용하면

이메일 정도는 정규식을 이용해서 간단하게 검사해줍니다.


<%

Function EmailChk( txtemail )


 Dim strMessage
 
 if instr( txtemail, "@" ) = 0 OR instr( txtemail, "." ) = 0 OR Len( txtemail ) < 7 Then
     strMessage = "유요하지 않은 이메일입니다"
 else
     strMessage = "유요한 이메일입니다."
 end if

   EmailChk = strMessage


end Function


Response.Write EmailChk( "test@test.com")

%>

2008/02/21 15:49 2008/02/21 15:49

Trackback Address :: https://youngsam.net/trackback/168