建立禁止关键字表
提交后查询文本内容是否包含关键字
如包含则禁止提交
==许多网站的过滤脏话就是这么做的!◎

解决方案 »

  1.   

    <html><head><title>New Page 1</title>
    <script>
    function check(str)
    {
      
      var reg=/fuck{0}/
      if(reg.test(str)){alert("您所提交的内容中包含不文明词语,请从新填写")}
      else{alert("123")}}</script>
    </head><body><form name="f1" method="POST" action="--WEBBOT-SELF--">  <p><input type="text" name="t1" size="20"></p>
      <p><input type="button" value="提交" name="B1" onClick="check(t1.value)"></p>
    </form></body></html>