当前位置:编程学习 > JAVA >>

FCKEditor 网页文本编辑器 js 调用报错

通过如下方法调用:

<script type="text/javascript" src="ckeditor/ckeditor.js"></script> 
<textarea name="content" cols="80" rows="4">
</textarea>
<script type="text/javascript">
var oFCKeditor = new FCKeditor("content"); 
oFCKeditor.BasePath = "<%=App %>/scirpts/ckeditor/";  
oFCKeditor.Height = 400; 
oFCKeditor.ToolbarSet = "Default";  
oFCKeditor.ReplaceTextarea();
</script>

运行后 IE 提示 如下错误
网页错误详细信息

用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; QQDownload 702; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
时间戳: Thu, 24 Nov 2011 01:41:04 UTC


消息: 'FCKeditor' 未定义
行: 245
字符: 1
代码: 0
URI: http://127.0.0.1:8080/PORTAL/business/lmgl/articleContent.jsp?cArea=0&lmID=9E5630A4ACE0A376DE1A603F4F9C7925&lmType=2&parentid=


请问 这个问题如何解决? --------------------编程问答-------------------- --------------------编程问答-------------------- <script type="text/javascript" src="ckeditor/ckeditor.js"></script>  
你有这JS吗,路径是否正确? --------------------编程问答-------------------- var oFCKeditor = new FCKeditor("content"); 
new出来的oFCKeditor 为unDefault吧。。。js文件引入路径肯定有问题。。。 --------------------编程问答-------------------- 测试页面
<%@ page language="java" import="com.fredck.FCKeditor.*" %>
<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="FCK" %>
<script type="text/javascript" src="${pageContext.request.contextPath}/FCKeditor/fckeditor.js"></script>

<%--
<form action="show.jsp" method="post" target="_blank">
 <FCK:editor id="content" basePath="/FCKeditor/"
       width="700"
       height="500"
       skinPath="/FCKeditor/editor/skins/silver/"
       toolbarSet = "Default"
 >
 input
        </FCK:editor>
<input type="submit" value="Submit">
</form>
--%>

<form action="show.jsp" method="post" target="_blank">
<table border="0" width="700"><tr><td>
<textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 400px">input</textarea>
<script type="text/javascript">
 var oFCKeditor = new FCKeditor('content') ;
 oFCKeditor.BasePath = "${pageContext.request.contextPath}/FCKeditor/" ;
 oFCKeditor.Height = 400;
 oFCKeditor.ToolbarSet = "Default" ; 
 oFCKeditor.ReplaceTextarea();
</script>
<input type="submit" value="Submit">
</td></tr></table>
</form>

<%--
<form action="show.jsp" method="post" target="_blank">
<%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "content" ) ;
oFCKeditor.setBasePath( "/FCKeditor/" ) ;
oFCKeditor.setValue( "input" );
out.println( oFCKeditor.create() ) ;
%>
<br>
<input type="submit" value="Submit">
</form>
--%>
显示页面


<%
String content = request.getParameter("content");
out.print(content);
%>
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,