FCKeditor编辑器的使用

本文详细介绍了FCKeditor富文本编辑器的调用步骤及如何获取编辑器内容。包括头部引用、显示编辑器代码示例及如何判断内容是否为空。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

调用:

step 1:

头部引用:

 <!-- #i nclude file="FCKeditor/fckeditor.asp" -->

step 2:

显示编辑器的from内插入如下代码:

<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/FCKeditor/"
oFCKeditor.Create "FCKeditor1"
%>

FCKeditor1就是from传递数据的名称了

step 3:

完整的代码如下:

<!-- #i nclude file="FCKeditor/fckeditor.asp" -->
<html>
  <head>
    <title>FCKeditor - Sample</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <form action="savedata.asp" method="post">
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/FCKeditor/"
oFCKeditor.Create "FCKeditor1"
%>
      <br>
      <input type="submit" value="Submit">
    </form>
  </body>
</html>

step 4:

可以这样来取得编辑器的值:

Dim sValue
sValue = Request.Form( "FCKeditor1" )


判断内容是否为空:

var checkContent =FCKeditorAPI.GetInstance("FCKeditor1").GetXHTML();
if (checkContent==""){
alert("文章内容不能为空!");
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
oEditor.Focus();
return false;
}

减肥参考:http://www.blueidea.com/tech/program/2005/2691.asp

可以这样来定制编辑器:

<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/fckeditor/"

oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "100%"
oFCKeditor.Height = "500"

oFCKeditor.Value = rs("message")
oFCKeditor.Create "FCKeditor1"
%> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值