国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > php开源 > DedeCMS > 动易CMS静态页调用FCK编辑器的代码

动易CMS静态页调用FCK编辑器的代码

来源:程序员人生   发布时间:2014-03-09 10:30:43 阅读次数:2579次

  网(LieHuo.Net)教程 最近有用户想实现AJAX写库,前台的文本框想替换成FCK编辑器,现在给出静态页调用FCK的一个参考例子,有兴趣的用户可以参考一下:

以下为引用的内容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FCKeditor - Sample - LIEHUO.NET</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<link href="../sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>//修改为自己的src
<script type="text/javascript">
window.onload = function()
{
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
var sBasePath = "./fckeditor/" ;//这里修改为你网站的fck编辑器文件夹的相对路径
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.ReplaceTextarea() ;
}

function btnclick()
{
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;

// Get the editor contents in XHTML.
alert( oEditor.GetXHTML( true ) ) ; // "true" means you want it formatted.获取fck编辑器的值的方法

}

</script>
</head>
<body>
<div>
<textarea name="FCKeditor1" rows="10" cols="80" style="width: 100%; height: 200px">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://www.fckeditor.net/"&gt;FCKeditor&lt;/a&gt;.&lt;/p&gt;</textarea>
</div>
<br />
<input id="btn" type="button" value="get content" onclick="btnclick()"/>

</body>
</html>

生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生