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>
推荐阅读