我用了fckeditor做了一个在线的文本编辑器,代码如下
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function getEditorContents(){
var oEditor = FCKeditorAPI.GetInstance("content");
var str=oEditor.GetXHTML();
alert(str);
return str;
}
</script>
</head><body>
 <form action="#" method="post">
<iframe src="../jsp/sample01.jsp" id="content" name="content" width="800" height="400"></iframe>
<input type="submit"  onclick="getEditorContents();" />
</form>
</body>
</html>

现在我要通过本页面把里边的HTML代码获得提交到数据库,可是,我用上面的页面测试好像没法获得编辑框里的内容,还请各位指点。

解决方案 »

  1.   

    sample01.jsp  是做什么的?你的FCKeditor似乎应该在sample01.jsp实现
      

  2.   

    用 fckeditor 的标签会简单很多
      

  3.   

    以前我是用的ewebeditor做的在线编辑框,不过好像无法实现文件的上传,最后就选择大家非常推荐的这一款fckeditor,可就是不知道怎么获取其中的HTML代码,sample01.jsp就是一个做好的别人做好的,可以直接通过内联框架导进来,不过不知道怎么实现把其中的内容添加到数据库中。