[伊达原创]实战FCKeditor在线编辑器
版权声明:原创作品,如需转载,请与作者联系。否则将追究法律责任。 |
在线编辑器有很多种,但是这个FCKeditor是最受欢迎的。单纯的留言本开发没什么难度了。在这个基础上我在编辑器的概念也引入了进来。 很简单的一个例子,官方压缩包里有个文件夹_samples里面有很多调用的方法和实例,今天说一下我的。 假设文件目录结构是 \www `````\test.php \www\FCKeditor <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>FCKeditor - Sample</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" /> </head> <body> <script type="text/javascript" src="./FCKeditor/fckeditor.js"></script> <script type="text/javascript"> window.onload = function() //打开页面自动载入该函数 { var oFCKeditor = new FCKeditor( 'content' ) ; //创建对象 oFCKeditor.BasePath = "./FCKeditor/" ; //主目录 oFCKeditor.Height = "380" ; //高度 oFCKeditor.Value = "" ; //编辑框里的默认值 oFCKeditor.Width = "100%" ; //宽度 oFCKeditor.ReplaceTextarea() ; //替换testarea文本 } </script> <h1>FCKeditor - PHP调用实例</h1> 方法以此类推,注意FCKeditor目录的位置 <hr> <form action="test2.php" method="post" target="_blank"> <textarea name="content" style="width:620px" rows="10" id="content" ></textarea> <br> <input type="submit" value="Submit"> </form> </body> </html> 你可以再写一个test2.php来输出一下这个结果。内容很简单 <?php echo $_POST["content"]; ?> 需要注意的有两个地方:<script type="text/javascript" src="./FCKeditor/fckeditor.js">和oFCKeditor.BasePath = "./FCKeditor/" ; 这两个相对路径的当前目录./绝对不能忽略。不信的话你删除一下试试就知道了。 本文出自 “Linux学习工坊” 博客,转载请与作者联系! 本文出自 51CTO.COM技术博客 |
附件下载:
NT版本
NT版本


semiscon
博客统计信息
热门文章
最新评论
友情链接
