2023-08-17 10:28:45
JS实现过滤自定义关键字
[ 2005-07-26 11:33:40 | 作者: 牛犊 ]
最近发现很多留言板受到广告的骚扰,我写了下面这个简单JS函数,可以自定义关键字过滤广告。
Read More...
<script language="JavaScript">
var myarray = new Array("关键字1","关键字2","关键字3");
function check(theForm) {
for (i=0;i<myarray.length;i++) {
if (theForm.name.value.indexOf(myarray[i])!=-1)
{alert("包含关键字");
return false;}
}
}
</script>
<form method="post" action="#">
<input value="" type="text" name="name">
<input type="submit"
...var myarray = new Array("关键字1","关键字2","关键字3");
function check(theForm) {
for (i=0;i<myarray.length;i++) {
if (theForm.name.value.indexOf(myarray[i])!=-1)
{alert("包含关键字");
return false;}
}
}
</script>
<form method="post" action="#">
<input value="" type="text" name="name">
<input type="submit"
Read More...
1