dourunlao1642
2012-05-15 08:29
浏览 23
已采纳

验证FCKEditor是否为空

i am trying to validate using JavaScript if the fckeditor value is blank or not but with no luck.

i am creating the Editor using javascript :

var oFCKeditor = new FCKeditor('txtMessage');
                                                 oFCKeditor.BasePath = "../fckeditor/";
                                                 oFCKeditor.ToolbarSet = "Default";
                                                oFCKeditor.Height = "500";
                                                  oFCKeditor.Value = "test";
                                                oFCKeditor.Create();

but when i use:

 if (document.form.txtMessage.value == "") {
      alert('You Must Enter a Message');

when the editor is empty and alerts me and i write something in it, it keeps alerting it is empty.

图片转代码服务由CSDN问答提供 功能建议

我试图使用JavaScript进行验证,如果fckeditor值为空或不是但没有运气。

我正在使用javascript创建编辑器:

  var oFCKeditor = new FCKeditor('txtMessage'); 
 oFCKeditor.BasePath =“../  fckeditor /“; 
 oFCKeditor.ToolbarSet =”Default“; 
 oFCKeditor.Height =”500“; 
 oFCKeditor.Value =”test“; 
 oFCKeditor.Create(); 
   
 
 

但是当我使用:

  if(document.form.txtMessage.value ==“”){
 alert('你必须 当编辑器为空时输入消息'); 
   
 
 

并提醒我并在其中写入内容,它会一直警告它是空的。 \ n

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsz90288 2012-05-15 08:34
    已采纳

    Check here

        <script type="text/javascript">
            function checksubmit() {        
                var FCKGetInstance = FCKeditorAPI.GetInstance('PageDescription');  
                var getText = FCKGetInstance.GetData(); 
                var StripTag = getText.replace(/(<([^>]+)>)/ig,"");
                if(StripTag=='') {
                    alert("This is required field");
                    return false;
                }
                else {
                    alert(StripTag);
                }       
            }
         </script>
    
    <input type="submit" name="submit" value="submit" onclick="javascript: return checksubmit();" />
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题