3、外聯(lián)編輯條(多個(gè)編輯域共用一個(gè)編輯條)
這個(gè)功能是2.3版本才開始提供的,以前版本的FCKeditor要在同一個(gè)頁(yè)面里用多個(gè)編輯器的話,得一個(gè)個(gè)創(chuàng)建,現(xiàn)在有了這個(gè)外聯(lián)功能,就不用那么麻煩了,只需要把工具條放在一個(gè)適當(dāng)?shù)奈恢茫竺婢涂梢詿o(wú)限制的創(chuàng)建編輯域了,如圖:
要實(shí)現(xiàn)這種功能呢,需要先在頁(yè)面中定義一個(gè)工具條的容器:<divid="xToolbar"></div>,然后再根據(jù)這個(gè)容器的id屬性進(jìn)行設(shè)置。
ASP實(shí)現(xiàn)代碼:
<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實(shí)現(xiàn)代碼:
<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>
此部分的詳細(xì)DEMO請(qǐng)參照: _samples/html/sample11.html _samples/html/sample11_frame.html
出處:藍(lán)色理想
責(zé)任編輯:moby
上一頁(yè) FCKeditor 實(shí)戰(zhàn)技巧 [1] 下一頁(yè) FCKeditor 實(shí)戰(zhàn)技巧 [3]
◎進(jìn)入論壇網(wǎng)頁(yè)制作、網(wǎng)站綜合版塊參加討論
|