当前位置: 首页 > 图文教程 > 网络编程 > PHP > fckeditor用javascript创建

PHP
PHP XML操作类DOMDocument
php jquery 实现新闻标签分类与无刷新分页
php 来访国内外IP判断代码并实现页面跳转
php 计算两个时间戳相隔的时间的函数(小时)
php 日期时间处理函数小结
PHP strtotime函数详解
PHP 抓取新浪读书频道的小说并生成txt电子书的代码
php 空格,换行,跳格使用说明
c#中的实现php中的preg_replace
PHP 分页原理分析,大家可以看看
php 8小时时间差的解决方法小结
PHP 源代码压缩小工具
php 常用类整理
在PHP中检查PHP文件是否有语法错误的方法
PHP simple_html_dom.php+正则 采集文章代码
PHP array_push 数组函数
php 文章采集正则代码
php 需要掌握的东西 不做浮躁的人
phpMyAdmin链接MySql错误 个人解决方案
PHP 获取目录下的图片并随机显示的代码

PHP 中的 fckeditor用javascript创建


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 47 ::
收藏到网摘: n/a

首先介绍如何用javascript创建fckeditor

//--------------------------------------------------------------------------------------------------

第一在头部有个引用:

CODE:
<script type="text/javascript" src="/upload/tech/20091102/20091103000515_fe7ee8fc1959cc7214fa21c4840dff0a.js"></script>
加入创建代码(创建的代码有多种形式)
第一种创建模式: 直接创建


CODE:
<script type="text/javascript">
var oFCKeditor = new FCKeditor('FCKeditor1');
oFCKeditor.BasePath = "/FCKeditor/";
oFCKeditor.Create();
</script>
第二种创建模式: 替换textarea

CODE:
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'MyTextarea' ) ;
oFCKeditor.BasePath = "/FCKeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
<textarea id="MyTextarea" name="MyTextarea">This is <b>the</b> initial value.</textarea>
在对于替换多个textArea时可以使用如下方法

CODE:
<html>
<head>
<title>Testing ReplaceAll()</title>

<script type="text/javascript" src="/upload/tech/20091102/20091103000515_fe7ee8fc1959cc7214fa21c4840dff0a.js"></script>

<script type="text/javascript">
<!--
function ReplaceAllTextareas() {
// replace all of the textareas
var allTextAreas = document.getElementsByTagName("textarea");
for (var i=0; i < allTextAreas.length; i++) {
var oFCKeditor = new FCKeditor( allTextAreas.name ) ;
oFCKeditor.BasePath = "/FCKeditor/" ;
oFCKeditor.ReplaceTextarea() ;
}
}
// -->
</script>

</head>

<body onLoad="javascript: ReplaceAllTextareas()">

<form>
<input type="checkbox" name="bobby" /> bobby <br />
<input type="checkbox" name="sue" /> sue <br />

Summary:
<textarea name="summary" rows="4" cols="80"> here is the summary </textarea>
Overview:
<textarea name=