/ / Access to HTML content editor
function getEditorHTMLContents (EditorName) (
var oEditor = FCKeditorAPI.GetInstance (EditorName);
return (oEditor.GetXHTML (true));
)
/ / Access to the text editor
function getEditorTextContents (EditorName) (
var oEditor = FCKeditorAPI.GetInstance (EditorName);
return (oEditor.EditorDocument.body.innerText);
)
/ / Set the content editor
function SetEditorContents (EditorName, ContentStr) (
var oEditor = FCKeditorAPI.GetInstance (EditorName);
oEditor.SetHTML (ContentStr);
)
FCKeditor loaded FCKeditorAPI is registered as a global object, we can use it to complete the various operations editor.
On the current page FCK Editor was examples:
var Editor = FCKeditorAPI.GetInstance ( 'InstanceName');
FCK Editor from the pop-up window in FCK Editor was examples:
var Editor = window.parent.InnerDialogLoaded (). FCK;
Page from the framework of the sub-frames access to other sub-frames in the FCK editor instance:
var Editor = window.FrameName.FCKeditorAPI.GetInstance ( 'InstanceName');
Pop-up window from the page to obtain the parent window of the FCK editor instance:
var Editor = opener.FCKeditorAPI.GetInstance ( 'InstanceName');
Access to the contents of FCK Editor:
oEditor.GetXHTML (formatted); / / formatted as: true | false, whether that removed HTML format
Can also be used:
oEditor.GetXHTML ();
Setting FCK Editor Content:
oEditor.SetHTML ( "content", false); / / The second parameter to: true | false, whether or not to WYSIWYG mode and its contents. This method is commonly used in the "set initial value" or "reset form" Oh for.
Insert the contents of the FCK Editor:
oEditor.InsertHtml ( "html"); / / "html" for HTML text
FCK editor to check whether the contents change:
oEditor.IsDirty ();
FCK editor in addition to call the FCK Editor toolbar command:
Command as follows:
DocProps, Templates, Link, Unlink, Anchor, BulletedList, NumberedList, About, Find, Replace, Image, Flash, SpecialChar, Smiley, Table, TableProp, TableCellProp, UniversalKey, Style, FontName, FontSize, FontFormat, Source, Preview, Save, NewPage, PageBreak, TextColor, BGColor, PasteText, PasteWord, TableInsertRow, TableDeleteRows, TableInsertColumn, TableDeleteColumns, TableInsertCell, TableDeleteCells, TableMergeCells, TableSplitCell, TableDelete, Form, Checkbox, Radio, TextField, Textarea, HiddenField, Button, Select, ImageButton, SpellCheck, FitWindow, Undo, Redo
Use are as follows:
oEditor.Commands.GetCommand ( 'FitWindow'). Execute ();
= FCKConfig.BasePath + 'plugins /'
/ / FCKConfig.Plugins.Add ( 'placeholder', 'en, it');
Removed / / after the placeholder is equivalent to the added functionality of the plug-ins, fckeditor documents are in the plug-ins / editor / plugins / folder under the folder classification placed by, for example fckeditor2.0, there are two folders, that is, there are two official plug-ins, placeholder to this folder that we just added, mainly for multi-parameter or a single custom tag parameters match, the production is very useful when editing the template, in order to see concrete examples, we can go to download the system to view acms study, tablecommands is another folder in the form editor used to edit the. Of course, if you want to create their own plug-ins for other purposes, then as long as the production of plug-ins in accordance with the rules fckeidtor finished placed in the / editor / plugins / under on the line, and then add in the fckeidtor.js in FCKConfig.Plugins.Add ( 'Plugin Name', ', lang, lang'); it.
The second part, how to open the editor, the editing tool does not appear, such as point "toolbar to start" appears when? Easy, FCKeditor itself, this feature provides you, open fckconfig.js, to find
FCKConfig.ToolbarStartExpanded = true;
Change
FCKConfig.ToolbarStartExpanded = false;
Can you!
The third part, the use of their own emoticons, also open to the very bottom of that period fckcofnig.js
FCKConfig.SmileyPath = FCKConfig.BasePath + 'images / smiley / msn /';
FCKConfig.SmileyImages = [ 'regular_smile.gif', 'sad_smile.gif', 'wink_smile.gif'];
FCKConfig.SmileyColumns = 8;
FCKConfig.SmileyWindowWidth = 320;
FCKConfig.SmileyWindowHeight = 240;
Above, this is my modified, the order of the pages I published this article撑得will not be too open, I changed the line FCKConfig.SmileyImages have only three expressions of Fig.
The first line is, of course, the path Emoticons settings, the second line is the icon file name related to the expression of a List, the third line of the expression refers to pop-up window to add the expression of each line the number of parameters are the following two rounds Modal window for a wide and high bonus.
The fourth part of the management of part of file uploads
This section may be of utmost concern to us, on an article about how simple modifications to upload files and the use of fckeidtor2.0 provide rapid upload feature. Then we continue to explain the deep-seated re-upload feature
FCKConfig.LinkBrowser = true;
FCKConfig.ImageBrowser = true;
FCKConfig.FlashBrowser = true; found in fckconfig.js 3, which is not linked to the 3 Oh, I just concentrate on them here, and is set to true means that allows the use of the fckeditor to view the document server-side image, as well as flash and so on, this function is when you insert a picture pop-up window on the "Browse Server" button can be reflected, if your editor is only used for their management or use only in the background, this feature is undoubtedly useful, because he lets you directly to the server's file upload operation. But if you should face the front of the system user or the blog to use such a system, then the security risk on the big Oh. So we are set to their false; as follows
FCKConfig.LinkBrowser = false;
FCKConfig.ImageBrowser = false;
FCKConfig.FlashBrowser = false;
In this way, we can be the only fast upload ah, good! Then on to modify the same to asp for example, and enter / editor / filemanager / upload / asp / open config.asp, modify
ConfigUserFilesPath = "/ UserFiles /" this set is the total upload directory, I would not move here, you want to change their changed
Good, and then open the directory upload.asp documents, find the following section of
Dim resourceType
If (Request.QueryString ( "Type") <> "") Then
resourceType = Request.QueryString ( "Type")
Else
resourceType = "File"
End If
And then add in its
ConfigUserFilesPath = ConfigUserFilesPath & resourceType &"/"& Year (Date ()) &"/"& Month (Date ()) & "/"
In that case, upload the document into the "/ userfiles / file types (such as image or file, or flash) / Year / Month /" this folder, this set of single-user to use are adequate, and if you want to to the multi-user systems, so be it to change
ConfigUserFilesPath = ConfigUserFilesPath & Session ( "username") & resourceType &"/"& Year (Date ()) &"/"& Month (Date ()) & "/"
This document uploaded into the "/ userfiles / user directory / file type / year / month /" was, of course, such arrangements if you do not want to modify into other, for example, a deeper level, such as the user's home directory, where Session ( "username") according to their own needs, please be amended or replaced.
From setting up the directory, but the upload process will not create these folders, if that does not exist, the upload will not succeed, then we have From the above path in accordance with the requirements of the directory recursively to generate a .
Find this
Dim sServerDir
sServerDir = Server.MapPath (ConfigUserFilesPath)
If (Right (sServerDir, 1) <> "\") Then
sServerDir = sServerDir & "\"
End If
It the following two lines
Dim oFSO
Set oFSO = Server.CreateObject ( "Scripting.FileSystemObject")
This paragraph with the following code to replace
dim arrPath, strTmpPath, intRow
strTmpPath = ""
arrPath = Split (sServerDir, "\")
Dim oFSO
Set oFSO = Server.CreateObject ( "Scripting.FileSystemObject")
for intRow = 0 to Ubound (arrPath)
strTmpPath = strTmpPath & arrPath (intRow) & "\"
if oFSO.folderExists (strTmpPath) = false then
oFSO.CreateFolder (strTmpPath)
end if
next
Make use of this code can be generated on the folder you want, and when the upload automatically.
Well, upload the changes to the present can be temporarily came to an end, however, there are still many Chinese users question, the file upload is the default fckeditor is not renamed, at the same time do not support Chinese file name, so is the uploaded file will become ". jpg" can not read this document, Then there will be duplicate names, and of course, duplicate names that do not, will automatically be renamed because the fckeditor will be added in the file name (1) to carry out such identification. However, we are accustomed to the usual procedure is to allow automatic generation of non-repetition of the file name
In just a section of code that is immediately below
'Get the uploaded file name.
sFileName = oUploader.File ( "NewFile"). Name
Clearly, this is the file name you, we have to put it away, of course, may have a function to generate the file name got replaced by the following
'/ / Get a number of non-repetition
Public Function GetNewID ()
dim ranNum
dim dtNow
randomize
dtNow = Now ()
ranNum = int (90000 * rnd) +10000
GetNewID = year (dtNow) & right ( "0" & month (dtNow), 2) & right ( "0" & day (dtNow), 2) & right ( "0" & hour (dtNow), 2) & right ( "0" & minute (dtNow), 2) & right ( "0" & second (dtNow), 2) & ranNum
End Function
'Get the uploaded file name.
sFileName = GetNewID () &"."& split (oUploader.File ( "NewFile"). Name ,".")( 1)
The uploaded file name is automatically generated 20050802122536365.jpg such as file name, and is accurate as well as the date when the composition of the three random number file name of the








Responses to “Check the use of Javascript and the value of FCKeditor”