2013-09-05 07:47:03
JS实现过滤自定义关键字
[ 2005-07-26 11:33:40 | 作者: 牛犊 ]
最近发现很多留言板受到广告的骚扰,我写了下面这个简单JS函数,可以自定义关键字过滤广告。
评论Feed: http://www.playcase.com/blog/feed.asp?q=comment&id=2
<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" name="Submit" value="提交" onClick="return check(this.form)">
</form>
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" name="Submit" value="提交" onClick="return check(this.form)">
</form>
[最后修改由 牛犊, 于 2005-07-31 17:18:14]

View Mode: 显示全部 |
评论: 1 |
引用: 0 | 排序 | 浏览: 19023

[ 2012-11-04 11:52:21 ]
楼主你懂的好多,兴趣真是广泛啊。崇拜啊