3、外联编辑条(多个编辑域共用一个编辑条)
这个功能是2.3版本才开始提供的,以前版本的FCKeditor要在同一个页面里用多个编辑器的话,得一个个创建,现在有了这个外联功能,就不用那么麻烦了,只需要把工具条放在一个适当的位置,后面就可以无限制的创建编辑域了,如图:

要实现这种功能呢,需要先在页面中定义一个工具条的容器:<divid="xToolbar"></div>,然后再根据这个容器的id属性进行设置。
ASP实现代码:
<div id="fckToolBar"></div> <% Dim oFCKeditor Set oFCKeditor = New FCKeditor with oFCKeditor .BasePath = fckPath .Config("ToolbarLocation") = "Out:fckToolBar"
.ToolbarSet = "Basic" .Width = "100%" .Height = "200"
.Value = "" .Create "jcontent"
.Height = "150" .Value = "" .Create "jreach" end with %>
JAVASCRIPT实现代码:
<div id="xToolbar"></div> FCKeditor 1: <script type="text/javascript"> <!-- // 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 = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ;
var oFCKeditor = new FCKeditor( 'FCKeditor_1' ) ; oFCKeditor.BasePath = sBasePath ; oFCKeditor.Height = 100 ; oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:parent(xToolbar)' ; oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using FCKeditor.' ; oFCKeditor.Create() ; //--> </script> <br /> FCKeditor 2: <script type="text/javascript"> <!-- oFCKeditor = new FCKeditor( 'FCKeditor_2' ) ; oFCKeditor.BasePath = sBasePath ; oFCKeditor.Height = 100 ; oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:parent(xToolbar)' ; oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using FCKeditor.' ; oFCKeditor.Create() ; //--> </script>
此部分的详细DEMO请参照: _samples/html/sample11.html _samples/html/sample11_frame.html
出处:蓝色理想
责任编辑:moby
上一页 FCKeditor 实战技巧 [1] 下一页 FCKeditor 实战技巧 [3]
◎进入论坛网页制作、网站综合版块参加讨论
|