특정 이메일 입력 금지및 이메일 유효성 검사

· 17년 전 · 2073

daum, naver, yahoo,hanmail 계정은 입력할 수 없습니다<br>

<form name="validation" onSubmit="return checkbae()">
이메일 주소 입력 :
<input type="text" size=18 name="emailcheck"><br>
<input type="submit">
</form>

<script language="JavaScript1.2">

var invalidaddress=new Array()
invalidaddress[0]="daum"
invalidaddress[1]="naver"
invalidaddress[2]="yahoo"
invalidaddress[3]="hanmail"

var testresults
function checkemail(){
var invalidcheck=0;
var str=document.validation.emailcheck.value
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str)){
var tempstring=str.split("@")
tempstring=tempstring[1].split(".")
for (i=0;i<invalidaddress.length;i++){
if (tempstring[0]==invalidaddress[i])
invalidcheck=1
}
if (invalidcheck!=1)
testresults=true
else{
alert("입력 금지된 계정입니다")
testresults=false
}
}
else{
alert("이메일 주소가 유효하지 않습니다")
testresults=false
}
return (testresults)
}
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
</script>

[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
17년 전 조회 2,716
17년 전 조회 6,272
17년 전 조회 1,768
17년 전 조회 1,884
17년 전 조회 3,604
17년 전 조회 1,900
17년 전 조회 1,374
17년 전 조회 2,354
17년 전 조회 2,008
17년 전 조회 6,036
17년 전 조회 5,838
17년 전 조회 2,015
17년 전 조회 2,074
17년 전 조회 3,929
17년 전 조회 2,145
17년 전 조회 1,607
17년 전 조회 2,747
17년 전 조회 2,391
17년 전 조회 4,169
17년 전 조회 3,935
17년 전 조회 4,082
17년 전 조회 2,165
17년 전 조회 1,612
17년 전 조회 3,199
17년 전 조회 3,584
🐛 버그신고