fckeditor怎么用(怎么用Javascript控制fckeditor编辑框里的内容)

本文目录
- 怎么用Javascript控制fckeditor编辑框里的内容
- VS使用fckeditor
- 如何在ASP.NET中使用FCKeditor的过程中,获取FCKeditor中的数据
- ColdFusion使用FCKeditor
- 如何使用FCKeditor修改Html
怎么用Javascript控制fckeditor编辑框里的内容
使用JAVASCRIPT版的FCK,在页面加载时(未打开FCK),创建一个隐藏的TextArea域,这个TextArea的name和ID要和创建的FCK实例名称一致,然后点击"Open Editor"按钮时,通过调用一段函数,使用FCK的ReplaceTextarea()方法来创建FCKeditor,代码如下:
CODE:
《script type="text/javascript"》
《!--
function showFCK(){
var oFCKeditor = new FCKeditor( ’fbContent’ ) ;
oFCKeditor.BasePath = ’/FCKeditor/’ ;
oFCKeditor.ToolbarSet = ’Basic’ ;
oFCKeditor.Width = ’100%’ ;
oFCKeditor.Height = ’200’ ;
oFCKeditor.ReplaceTextarea() ;
}
//--》
《/script》
《textarea name="fbContent" id="fbContent"》textarea》
然后就可以根据FCKeditor器的API控制你的fckeditor。
比如最基本的数据验证,如何在提交的时候用JS判断当前器区域内是否有内容,FCK的API提供了GetLength()方法;
再比如如何通过脚本向FCK里插入内容,使用InsertHTML()等;
还有,在用户定制功能时,中间步骤可能要执行FCK的一些内嵌操作,那就用ExecuteCommand()方法。
详细的API列表,请查看FCKeditor的Wiki。而常用的API,请查看FCK压缩包里的_samples/html/sample08.html。此处就不贴代码了。
VS使用fckeditor
1.
在下载的文件中包含控件的源代码和一个已经编译好的文件("FredCK.FCKeditorV2.dll")。需要在你的项目中引用编译好的DLL文件,引用有2个方法:
手动复制FredCK.FCKeditorV2.dll 文件到你网站的"bin"目录
在你的Visual Studio.Net项目中按右键并选择“添加引用” ,从你保存FredCK.FCKeditorV2.dll 文件的地方选择他。
你也可以直接在Visual Studio.Net工具箱中包含这个控件,在工具箱中右键,选择“添加项”,然后,选择FredCK.FCKeditorV2.dll 。
确保你已经有了最新的DLL文件版本。
2.
现在就可以在你的网站上使用他了,新建一个ASP.Net页面,在页面上创建一个实例,有2个方法:
把控件从工具箱中拖到你的页面(如果你已经在“第二步”中把他加到你的工具箱)
在你的ASP.Net页面顶部包含以下代码:
《%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %》
并且在《FORM runat="server"》中添加控件的标签:
《FCKeditorV2:FCKeditor id="FCKeditor1" BasePath="~/FCKeditor/" runat="server" /》
注意: BasePath 属性所指定的目录就是FCKeditor 所在的目录
全部代码如下
《%@ Page ValidateRequest="false" Language="VB" AutoEventWireup="false" %》
《%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %》
《html》
《head》
《title》FCKeditor - Sample《/title》
***隐藏网址***
《/head》
《body》
《form runat="server"》
《FCKeditorV2:FCKeditor id="FCKeditor1" BasePath="~/FCKeditor/" runat="server" /》
《br /》
《input type="submit" ="Submit" runat="server" /》
《/form》
《/body》
《/html》
如何在ASP.NET中使用FCKeditor的过程中,获取FCKeditor中的数据
如果要用到上传文件,就要下载fck对应的dll程序,并对web.config进行配置(跟fck所在文件夹有关系):
《add key="FCKeditor:BasePath" value="~/路径/FCKeditor/" /》
《add key="FCKeditor:UserFilesPath" value="~/upload/" /》
fckconfig.js里配置
var _FileBrowserLanguage = ’aspx’ ;
var _QuickUploadLanguage = ’aspx’ ;
fckeditor\editor\filemanager\connectors文件夹下保留aspx文件夹,其它删除.打开aspx对config.ascx设置:
private bool CheckAuthentication()
{
return true;//改这里,默认是false
}
--------------------------------------------------------------
使用的时候用简单的引用方法
例如你的.net页里有text控件abc,
《iframe id="Editor" width="90%" height="250" name="Editor" src="fckeditor/editor/fckeditor.html?InstanceName=abc" frameborder="0" marginheight="0" marginwidth="0" scrolling="No"》《/iframe》
这里面InstanceName参数就是此FCK对应的textbox的ID
FCK皮肤、按钮之类的也可以进行配置,如有需要可以发信息一块讨论。
----------------------------------------------------
.net里你直接给input添加runat不知道会不会提示错误,不过生成input或是textarea的是textbox,你用visual软件可以直接拉一个看。
ColdFusion使用FCKeditor
一、注意配置FckEditor目录下的fckconfig.js文件。
// 设置快速上传的支持语言,我们选择的是cfm
var _QuickUploadLanguage = ’cfm’ ; // asp | aspx | cfm | lasso | php
// 下面设置了链接、图片、Flash的快速上传功能的内容,包括支持的扩展名及限制的扩展名文件
FCKConfig.LinkUpload = true ;
FCKConfig.LinkUploadURL = FCKConfig.BasePath + ’filemanager/upload/’ + _QuickUploadLanguage + ’/upload.’ + _QuickUploadLanguage ;
FCKConfig.LinkUploadAllowedExtensions = "" ; // empty for all
FCKConfig.LinkUploadDeniedExtensions = ".(php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi)$" ; // empty for no one
FCKConfig.ImageUpload = true ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath + ’filemanager/upload/’ + _QuickUploadLanguage + ’/upload.’ + _QuickUploadLanguage + ’?Type=Image’ ;
FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png)$" ; // empty for all
FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one
FCKConfig.FlashUpload = true ;
FCKConfig.FlashUploadURL = FCKConfig.BasePath + ’filemanager/upload/’ + _QuickUploadLanguage + ’/upload.’ + _QuickUploadLanguage + ’?Type=Flash’ ;
FCKConfig.FlashUploadAllowedExtensions = ".(swf|fla)$" ; // empty for all
FCKConfig.FlashUploadDeniedExtensions = "" ; // empty for no one
二、配置好上面的fckconfig.js文件后,再查看FCKeditor\editor\filemanager\browser\default\connectors\cfm\config.cfm文件
这里需要配置的是两行代码:
// 设置cfm上传功能为true
config.enabled = true;
// 设置上传的文件路径
config.userFilesPath = "/upload/";
三、然后再配置FCKeditor\editor\filemanager\upload\cfm\config.cfm文件
这里需要配置的也是两行代码:
// 设置cfm上传功能为true
config.enabled = true;
// 设置上传的文件路径
config.userFilesPath = "/upload/";
如何使用FCKeditor修改Html
FCKConfig.FullPage = true ;
即可包括《html》《/html》

本文相关文章:
把图片转换成word文档的软件(把图片文字转换成word文档的软件)
2026年7月4日 03:50
plsql连接oracle时database(plsql怎么连接oracle)
2026年10月6日 09:30
html中ahref(HTML中:或者 ,href后面直接跟“/“或者是“/products/“是什么)
2026年9月21日 14:40
formulate是什么意思(formulate是什么意思中文翻译)
2026年9月20日 16:50
app下载软件免费(怎样去appstore下载免费软件不用密码)
2026年9月18日 20:20
winform下拉框(C# winform 下拉列表控件(comboBox))
2026年9月18日 06:30
更多文章:
javascript arraybuffer(javascript可以把base64编码转换成二进制代码吗求示例代码!)
2026年10月11日 04:00
text函数公式(excel中round和text函数的区别是什么)
2026年10月11日 03:50
google chrome打不开(chrome浏览器打不开怎么回事 浏览器打不开的处理方法)
2026年10月11日 02:00
websocket整合springboot(Springboot整合Websocket遇到的坑)
2026年10月11日 01:40
drawerlayout(android 怎样让drawerlayout设置的侧滑菜单的内容充满屏幕)
2026年10月10日 19:20
xor四位数怎么运算(单片机怎样用C语言实现4个数字间的异或)
2026年10月10日 17:50
perl数组中最多的元素(用perl实现,得到一个数组中重复次数最多的元素)
2026年10月10日 17:00
oracle11g端口映射客户端频繁掉线(oracle本地进行连接的时候报错ORA-12560: TNS: 协议适配器错误)
2026年10月10日 16:10

