FCKeditor JS API
来源:互联网 发布:dell网络控制器驱动 编辑:程序博客网 时间:2024/05/22 11:57
1 // FCKeditor_OnComplete is a special function that is called when an editor
2 // instance is loaded ad available to the API. It must be named exactly in
3 // this way.
4 function FCKeditor_OnComplete( editorInstance )
5 {
6 // Show the editor name and description in the browser status bar.
7 document.getElementById('eMessage').innerHTML = 'Instance "' + editorInstance.Name + '" loaded - ' + editorInstance.Description ;
8
9 // Show this sample buttons.
10 document.getElementById('eButtons').style.visibility = '' ;
11 }
12
13 function InsertHTML()
14 {
15 // Get the editor instance that we want to interact with.
16 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
17
18 // Check the active editing mode.
19 if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
20 {
21 // Insert the desired HTML.
22 oEditor.InsertHtml( '- This is some sample HTML -' ) ;
23 }
24 else
25 alert( 'You must be on WYSIWYG mode!' ) ;
26 }
27
28 function SetContents()
29 {
30 // Get the editor instance that we want to interact with.
31 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
32
33 // Set the editor contents (replace the actual one).
34 oEditor.SetHTML( 'This is the I want new contentin the editor.' ) ;
35 }
36
37 function GetContents()
38 {
39 // Get the editor instance that we want to interact with.
40 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
41
42 // Get the editor contents in XHTML.
43 alert( oEditor.GetXHTML( true ) ) ; // "true" means you want it formatted.
44 }
45
46 function ExecuteCommand( commandName )
47 {
48 // Get the editor instance that we want to interact with.
49 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
50
51 // Execute the command.
52 oEditor.Commands.GetCommand( commandName ).Execute() ;
53 }
54
55 function GetLength()
56 {
57 // This functions shows that you can interact directly with the editor area
58 // DOM. In this way you have the freedom to do anything you want with it.
59
60 // Get the editor instance that we want to interact with.
61 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
62
63 // Get the Editor Area DOM (Document object).
64 var oDOM = oEditor.EditorDocument ;
65
66 var iLength ;
67
68 // The are two diffent ways to get the text (without HTML markups).
69 // It is browser specific.
70
71 if ( document.all ) // If Internet Explorer.
72 {
73 iLength = oDOM.body.innerText.length ;
74 }
75 else // If Gecko.
76 {
77 var r = oDOM.createRange() ;
78 r.selectNodeContents( oDOM.body ) ;
79 iLength = r.toString().length ;
80 }
81
82 alert( 'Actual text length (without HTML markups): ' + iLength + ' characters' ) ;
83 }
84
85 function GetInnerHTML()
86 {
87 // Get the editor instance that we want to interact with.
88 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
89
90 alert( oEditor.EditorDocument.body.innerHTML ) ;
91 }
92
93 function CheckIsDirty()
94 {
95 // Get the editor instance that we want to interact with.
96 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
97 alert( oEditor.IsDirty() ) ;
98 }
99
100 function ResetIsDirty()
101 {
102 // Get the editor instance that we want to interact with.
103 var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
104 oEditor.ResetIsDirty() ;
105 alert( 'The "IsDirty" status has been reset' ) ;
106 }
107
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
- FCKeditor JS API
- 解读FCKeditor -- fckeditor.js
- FCKeditor JavaScript API
- Fckeditor API函数
- PHP FCKEditor的API
- FCKeditor API使用详解
- FCKeditor API使用详解
- Fckeditor API 详解
- FCKeditor API使用详解
- FCKeditor API使用详解
- FCKeditor的js验证
- FCKeditor的js验证
- FCKeditor 配置使用 JS获取FCKeditor内容
- fckeditor全局api及中文翻译
- JS获取或设置FCKEditor,JS操作FCKEditor控件
- FCKeditor offers a complete JavaScript API ,FCKeditor的JSAPI
- js与Fckeditor的交互
- FCKeditor设置文件 "fckconfig.js"
- Think of Ext2.0 (2)
- Think of Ext2.0 (3)
- extjs中文解决方案/Eclipse下的js和ext开发
- EXT2 FCKeditor 整合
- don't know how to make错位原因
- FCKeditor JS API
- debian的screenshots
- JSF整理(四)
- PPC精品软件集
- Fckeditor 资料整理(java版)
- P2P应用的困难
- 获取的网卡MAC地址的通用方法
- 教育储蓄存款利息所得免征个人所得税实施办法
- hibernate3.2.2文档 还是要看文档