当前位置: 代码迷 >> Web前端 >> FCKEditor中,判断编辑器中的内容是不是为空
  详细解决方案

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

热度:20   发布时间:2012-11-09 10:18:48.0
FCKEditor中,判断编辑器中的内容是否为空
<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>









?

  相关解决方案