欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

FCKEditor中,判断编辑器中的内容是否为空

程序员文章站 2022-03-20 13:29:44
...
<script type="text/javascript" src="${path}/fckeditor/fckeditor.js"></script>

<script type="text/javascript">
	var oFCKeditor;
	window.onload = function(){
		oFCKeditor = new FCKeditor("content") ;   
		oFCKeditor.BasePath = "${path}/fckeditor/";
		oFCKeditor.Height = 300;
		oFCKeditor.ToolbarSet = "Mybbs";
		oFCKeditor.ReplaceTextarea();	
	}
	//提交判断非空
	function validate(){
		var oEditor = FCKeditorAPI.GetInstance("content");			
		if(oEditor.GetXHTML() == "" || oEditor.GetXHTML() == "<br />"){
			alert("内容不能为空!");
			return;
		}
	}
</script>
  

 <body>

 ......
 	<textarea name="content" id="content"></textarea>
 ......
 
</body>