ckeditor+ckfinder的在线编辑问题
网上找了半天,都说配置一下就可以了。晕,我自己照别人说的做,就是不成功。哎网站目录为:
\Admin\Addnew.aspx
\ckeditor
\ckfinder
addnew.aspx文件代码为:
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<title>增加资料</title>
<style type="text/css">
.ddl{ width:300px;}
.txt{ width:680px;}
</style>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" Runat="Server">
<div>增加资料</div>
<table>
<tr>
<td>资源属性:</td>
<td><asp:DropDownList ID="ddlProperty" runat="server" CssClass="ddl"></asp:DropDownList></td>
<td>学 科:</td>
<td>
<asp:DropDownList ID="ddlSubject" runat="server" CssClass="ddl"></asp:DropDownList>
</td>
</tr>
<tr>
<td>教 材:</td>
<td><asp:DropDownList ID="ddlSAC" runat="server" CssClass="ddl"></asp:DropDownList></td>
<td>文件类型:</td>
<td>
<asp:DropDownList ID="ddlFileExtension" runat="server" CssClass="ddl">
</asp:DropDownList>
</td>
</tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr>
<td>标 题:</td>
<td colspan="3">
<asp:TextBox ID="tbTitle" runat="server" CssClass="txt"></asp:TextBox>
</td>
</tr>
<tr>
<td>内容描述:</td>
<td colspan="3">
<asp:TextBox ID="tbContent" runat="server" class="ckeditor" Height="300"></asp:TextBox>
<script type="text/javascript">
CKEDITOR.replace('tbContent',{ skin: 'kama',filebrowserBrowseUrl:'../ckfinder/ckfinder.html',
filebrowserImageBrowseUrl:'../ckfinder/ckfinder.html?Type=Images',
filebrowserFlashBrowseUrl:'../ckfinder/ckfinder.html?Type=Flash',
filebrowserUploadUrl:'../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
filebrowserImageUploadUrl:'../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images',
filebrowserFlashUploadUrl:'../ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'
}); </script>
</td>
</tr>
<tr>
<td>资源文件:</td>
<td colspan="3">
<asp:FileUpload ID="fuResource" runat="server" CssClass="txt"/>
</td>
</tr>
<tr>
<td colspan="4">
<asp:Button ID="btSubmit" runat="server" Text="提交" onclick="btSubmit_Click" />
</td>
</tr>
</table>
</asp:Content>
运行的时候,可以编辑,但内容不能保存,其次,图片也不能上传。
请各位帮忙解决一下,谢了。
也可以给一下简单的例程。 --------------------编程问答-------------------- ckeditor 使用 --------------------编程问答-------------------- 我也新手,不过我前段时间遇到你的这个问题 现在已经解决了。呵呵
我给你看下我的配置方法:
1. ckeditor 的 config.js
/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config )
{
config.language = 'zh-cn';//中文
// config.uiColor = '#AFEEEE';//编辑器颜色
config.font_names = '微软雅黑;宋体;楷体_GB2312;新微软雅黑;黑体;隶书;幼圆;微软雅黑;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana';
config.易做图_Full =
[
['Source','-','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField','Table'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks','-','About','pagination']
];
config.易做图_Basic =
[
['Bold', 'Italic', 'TextColor','BGColor','Smiley']
];
//config.width = 100;//宽度
config.extraPlugins = 'pagination';
//高度config.height = 250;//高度
config.filebrowserBrowseUrl = '/host/ckfinder/ckfinder.html';
config.filebrowserImageBrowseUrl = '/host/ckfinder/ckfinder.html?Type=Images';
config.filebrowserFlashBrowseUrl = '/host/ckfinder/ckfinder.html?Type=Flash';
config.filebrowserUploadUrl = '/host/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files';
config.filebrowserImageUploadUrl = '/host/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images';
config.filebrowserFlashUploadUrl = '/host/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash';
config.filebrowserWindowWidth = '800';
config.filebrowserWindowHeight = '500';
};
2. CF 的路径要设置对哦
3.页面需要调用两个JS
<script src="../ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="../ckfinder/ckfinder.js" type="text/javascript"></script>
4。textbox 的设置
<div><div style ="background-color:#E0F4FF; height:35px; line-height:35px;font-family: 微软雅黑; font-size: large; color: #000000; font-weight: bold;" align="left">---- 摘要 ----</div>
<asp:TextBox ID="i_content" runat="server" AutoPostBack="True" Height="320px"
TextMode="MultiLine" Width="100%"></asp:TextBox>
<script type="text/javascript">
CKEDITOR.replace('<%= i_content.ClientID %>', {skin : 'kama',height:'320',uiColor :'#b4e6fe'});
</script></div>
基本就这些地方,我感觉你能解决问题的,呵呵
--------------------编程问答--------------------
<asp:TextBox runat="server" ID="txtContent" TextMode="MultiLine" Width="440px" Height="400"></asp:TextBox>楼主试试这样 就可以存储 文本了 图片还需要获取下 --------------------编程问答-------------------- 为何我在tbContent.text取不到值呢 --------------------编程问答-------------------- 为何我在tbContent.text取不到值呢,应该怎么才能取出取来? --------------------编程问答-------------------- tbContent.value看看. --------------------编程问答-------------------- url改绝对路径
<script type="text/javascript">CKEDITOR.replace('<%=txtContent.ClientID %>');</script>
去掉..以/开头
问题应该出在你替换的控件上,既然你的tbContent是服务器端的textbox控件,你生成ckeditor时应该替换的就是它的ClientID,
CKEDITOR.replace('<%= tbContent.ClientID %>',{...});
至于你说能编辑,确实有点奇怪,或许你页面上还有另一个html控件id为tbContent --------------------编程问答-------------------- KAO,原来用textbox不能取到值的,换一个textarea就可以了,现在想办法解决上传的问题。哎…… --------------------编程问答-------------------- 上传图片时,提示:未能映射路径“/ckfinder/userfiles/images/”。
不知道如何解决呀 --------------------编程问答-------------------- 各位,帮帮忙!
补充:.NET技术 , ASP.NET