출처
http://dotplekr.cafe24.com/board_pWob56/725
<script language="JavaScript1.2">
// Word Filter
// (c) 2002 Premshree Pillai
// Created : 23 June 2002
// http://www.qiksearch.com
// http://javascript.qik.cjb.net
// E-mail : qiksearch@rediffmail.com
var swear_words_arr=new Array("가증","씹팔","전쟁","바보","쓰발","엽기"); // 제한 목록
var swear_alert_arr=new Array;
var swear_alert_count=0;
function reset_alert_count()
{
swear_alert_count=0;
}
function validate_user_text()
{
reset_alert_count();
var compare_text=document.tagin_netform.user_text.value;
for(var i=0; i<swear_words_arr.length; i++)
{
for(var j=0; j<(compare_text.length); j++)
{
if(swear_words_arr[i]==compare_text.substring(j,(j+swear_words_arr[i].length)).toLowerCase())
{
swear_alert_arr[swear_alert_count]=compare_text.substring(j,(j+swear_words_arr[i].length));
swear_alert_count++;
}
}
}
var alert_text="";
for(var k=1; k<=swear_alert_count; k++)
{
alert_text+="n" + "(" + k + ") " + swear_alert_arr[k-1];
}
if(swear_alert_count>0)
{
// 불량단어 나왔을때 멘트
alert(alert_text+"는 입력할 수 없는 단어입니다");
// 불량단어 나왔을때 멘트
document.tagin_netform.user_text.select();
}
else
{
document.tagin_netform.submit();
}
}
function select_area()
{
document.tagin_netform.user_text.select();
}
window.onload=reset_alert_count;
</script>
<form name="tagin_netform" method="post" action="">
불량 단어 검축(필터링 스크립트)<br>
불량단어 예제 : 가증,씹팔,전쟁,바보,쓰발,엽기<br>
<br>
<textarea rows="3" cols="40" name="user_text" onclick="select_area()">쓰발</textarea>
<br>
<br>
<input type="button" value="확인" onclick="validate_user_text();">
</form>