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

PHP
include()与require()的对比
php和asp对象的等价关系
PHP, JScript 和 VBScript 函数和类的语法
PHP:MVC迷思
PHP脚本的8个技巧(1)
PHP脚本的8个技巧(2)
PHP脚本的8个技巧(3)
PHP脚本的8个技巧(4)
PHP脚本的8个技巧(5)
PHP脚本的8个技巧(6)
PHP脚本的8个技巧(7)
PHP脚本的8个技巧(8)
PHP教程.经验技巧(上)
递归列出所有文件和目录
PHP的历史和优缺点
PHP下MAIL的另一解决方案
PHP文本数据库的搜索方法
PHP调用三种数据库的方法(1)
PHP调用三种数据库的方法(2)
PHP调用三种数据库的方法(3)

PHP 中的 fckeditor用javascript创建


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 65 ::
收藏到网摘: 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=