zoukankan      html  css  js  c++  java
  • js dongtai xianshi textarea zishu

    <form name="FORM" id="FORM" method="post" action="?action=$atc"  enctype="multipart/form-data" onsubmit="return CheckForm();">

    <textarea name='postdb[content]' id='atc_content' style='700px;height:392px;;' onkeyup="checkLength();">$rsdb[content]</textarea>

    <br/>
    已输入字数:<span id="zs" style="color:Red;">0</span> (内容一定要丰富,充实,一般在8000字以上时,收录 和 排名 效果才会很好,里面内容请勿 重复、堆叠!)
    <br/>
    <span style="color:#CC6600"></span><font color='red' id="show_word"></font>


    <SCRIPT LANGUAGE="JavaScript">
       // 多个敏感词,这里直接以数组的形式展示出来
       var arrMg = ["fuck", "tmd", "他妈的", "按摩"];
     
    </SCRIPT>
     
    <SCRIPT LANGUAGE="JavaScript">
              
              
        function Trim(str,is_global)
            {
                var result;
                result = str.replace(/(^s+)|(s+$)/g,"");
                if(is_global.toLowerCase()=="g")
                {
                    result = result.replace(/s/g,"");
                 }
                return result;
          }
     
     
    function CheckForm(){
           //检测内容里是否有敏感词
              var inputContent = Trim($('#atc_title').val().toLowerCase()+$('#atc_keywords').val().toLowerCase()+$('#atc_content').val().toLowerCase(),"g");
              var showContent="";
           for (var i = 0; i < arrMg.length; i++) {
                if(inputContent.indexOf(arrMg[i]) > 0){
                    showContent =showContent+arrMg[i]+", ";
                     }
                    }
          if(showContent.length>0){
               alert("发现 敏感词!");
               $('#show_word').html("发现敏感词:"+showContent.toString());
               return false;
            }
     
         //检测内容是否超过5000字
         if($('#atc_content').val().length<2000){
                 var truthBeTold = window.confirm("信息内容 过少,为了你的信息能 获得好的 收录 和 排名,强烈建议增加 内容,最好 超过5000字 !\n\n内容一定要丰富,充实,一般在5000字以上时,收录 和 排名 效果才会很好,内容请勿 重复、堆叠!\n\n\n\n\n\n单击“确定”继续发布。单击“取消”返回增加内容。");
                 if (truthBeTold) {
                  
                   } else {return false;}
               }
         
     
     
      
       }
     
     
     
    function checkLength() {
            var curr =  $('#atc_content').val().length; //当前输入的
            $('#zs').html(curr.toString());
    }
     
    </SCRIPT>
    

      

  • 相关阅读:
    【转】#pragma pack(push,1)与#pragma pack(1)的区别
    emwin 之变量定义位置
    【转】C语言字符串与数字相互转换
    【转】用emWin进度条控件做个表盘控件,效果不错
    emwin 之消息 WM_INIT_DIALOG
    emwin 之使用键盘数据发送函数的注意事项
    emwin 解决在A窗口上新建B窗口后‘只激活’B窗口问题
    【转】数学与编程——求余、取模运算及其性质
    hdu4831 Scenic Popularity(线段树)
    2014年百度之星程序设计大赛
  • 原文地址:https://www.cnblogs.com/chenjian/p/6713267.html
Copyright © 2011-2022 走看看