| 发表于:2007-04-07 18:07:33 楼主 |
我刚学asp,自己试着写了个过滤代码,想实现对发表的脏话的过滤功能. 第一种写法是放在接收表单页的: <% word=request.form( "content ") str= "脏话关键词,用 ¦隔开 " str=split(str, " ¦ ") for i=lbound(str) to ubound(str) word=replace(word,str(i), "** ") next %> 上面我是想使用split和replace两个函数实现脏话过滤,我运行了,是可以通过的. 但是我又写了第二种方法,自定义了个过程,代码如下: <% function checkwords(word) str= "脏话挂念词,用 ¦隔开 " str=split(str, " ¦ ") for i=lbound(str) to ubound(str) word=replace(word,str(i), "** ") next end function %> 然后我调用这个过程: <%=checkwords(request.form( " content "))%> 不知道为什么,却运行错误.显示不出表单的内容,到底错在哪儿?希望懂的指教啊.我都想了两天了. |
|
|
|
|