首页产品库评测行情新闻|手机数码笔记本台式机DIY硬件数字家庭数码相机办公外设|软件下载游戏开发|社区

更多

数码相机
MP4
LCD
机箱
音箱

软件资讯设计 工具 系统 开发 安全 办公 陶吧 IT教育 Windows 7 | 下载中心天极下载中心诚征下载通路合作伙伴
天极网 > 软件频道 > 网页陶吧>FCKeditor在ASP环境中配置使用

FCKeditor在ASP环境中配置使用

2006-10-13 09:25作者:未知出处:互联网责任编辑:龙犊

  接下来呢,就讲一下如何创建自己的在线编辑器,这里以ASP和JS版的为例,ASP版示例代码,一般用于后台操作:

 <%
 Dim oFCKeditor
 Set oFCKeditor = New FCKeditor
 oFCKeditor.BasePath = "/" 
 oFCKeditor.ToolbarSet = "Default"
 oFCKeditor.Width = "100%"
 oFCKeditor.Height = "400"
 oFCKeditor.Value = rs("logbody")
 oFCKeditor.Create "logbody"
 %>

<%

  Dim oFCKeditor

  Set oFCKeditor = New FCKeditor

  oFCKeditor.BasePath = "/"

  oFCKeditor.ToolbarSet = "Default"

  oFCKeditor.Width = "100%"

  oFCKeditor.Height = "400"

  oFCKeditor.Value = rs("logbody")

  oFCKeditor.Create "logbody"

  %>

  ASP版的,当然只能用在以.asp为扩展名的页面中,如果你在前在fckedito.asp里设置过BasePath为"/"的话,这里就可以省掉第三行,ASP版的只有一个Create函数。建议在修改一篇内容时用ASP版的。

  接下来看JS版的:

 <script type="text/javascript">
 var oFCKeditor = new FCKeditor( 'logbody' ) ;
 oFCKeditor.BasePath = '/' ;
 oFCKeditor.ToolbarSet = 'Basic' ;
 oFCKeditor.Width = '100%' ;
 oFCKeditor.Height = '400' ;
 oFCKeditor.Value = '' ;
 oFCKeditor.Create() ;
 </script>
  

  BasePath的设置同上所述,JS版的可用于任何网页中,甚至用于html页面,因为其是客户端生成的,这样的好处就是一可以减小网络流量,因为编辑器文件只需下载一次,二是可以由客户端定义什么时候显示,由于fckeditor初始化需要一定时间,在这一点上JS就很有作用了。

  另外,JS版的还有一个功能函数就是ReplaceTextarea()函数,可以替换指定的TextArea,拿我的网站的日志的回复部分示例:

     <script type="text/javascript">
     <!--
     function showFCK(){
     var oFCKeditor = new FCKeditor( 'fbContent' ) ;
     oFCKeditor.BasePath = '/' ;
     oFCKeditor.ToolbarSet = 'Basic' ;
     oFCKeditor.Width = '100%' ;
     oFCKeditor.Height = '200' ;
     oFCKeditor.Value = '' ;
     //oFCKeditor.Create() ;
     oFCKeditor.ReplaceTextarea() ;
     //document.blog_feedback.blogsubmit.disabled = '';
     document.blog_feedback.blogsubmit.style.display = '';
     document.blog_feedback.openFCK.disabled = 'true';
     document.blog_feedback.openFCK.style.display = 'none';
     }
     //-->
     </script>

  把其写成一个简单的函数,当用户显示打开编辑器时才生成这个fckeditor,不用每次刷新页面都去初始化一个编辑器,页面的速度就会快多了。

  补遗:前面讲到了,说是在编辑已有数据内容时不要用JS版的,那是因为单引号(')的问题造成的,在数据内容里难免会有单引号存在而用JS版生成编辑器时可能就会因为单引号问题,而使编辑器无法正常生成,而采用asp则不同,用ASP版本的是因为数据被当成是一个变量了,然后直接赋值给编辑器域。还有就是除非你要用ReplaceTextArea()方法来生成编辑器,否则你不需先写一个<textarea>这样的标签,一切都会由fckeditor自动生成的,你所需做的只是给fckeditor指定一个实例名。同时你也不用担心如何提交,在表单提交的时候,fckeditor会自动提交,提交的变量名是以你指定的fckeditor实例命名的。

      fckeditor最新版本是2.3.1,下载地址:http://www.fckeditor.net/download


  阅读关于 FCKeditor ASP 在线编辑器 网页陶吧 龙犊 的全部文章 热卖推荐: 手机 诺基亚 MP5 电脑包 双卡双待 手机链 U盘 笔记本电脑

关注此文的读者还看过:

返回网页陶吧首页

共5页。 上一页12345

软件频道最新更新

热点推荐

IT嘉年华

编辑推荐

软件下载

热门
推荐

网友关注

软件
资料
游戏

装机推荐

文章排行

本周
本月
最新更新
天极服务|关于我们|About us|网站律师|RSS订阅|友情合作|加入我们|天极动态|网站地图|意见反馈|MSN/QQ上看天极
Copyright (C) 1999-2012 Yesky.com, All Rights Reserved 版权所有 天极网络