// JScript File
// Preview
Function Preview (){
Ofckeditor. value = fckeditorapi. getinstance ('fckeditor1'). getxhtml (true );
Fckeditorapi. getinstance ('fckeditor1'). Preview ();
}
// Source code/edit and convert
Function viewsrc ()
{
VaR OBJ = fckeditorapi. getinstance ('fckeditor1 ');
Ofckeditor. value = obj. getxhtml (true );
OBJ. switcheditmode (fck_editmode_source );
If (obj. editmode = fck_editmode_source)
{
Document. getelementbyid ("btn_src"). value = "edit ";
Document. getelementbyid ("btn_src"). Title = "edit as WYSIWYG module ";
}
Else
{
Document. getelementbyid ("btn_src"). value = "source code ";
Document. getelementbyid ("btn_src"). Title = "Edit with source code module ";
}
}
// Increase the size of the editing area
Function upsize ()
{
VaR Height = ofckeditor. height;
If (height <1200)
{
Ofckeditor. Height = ofckeditor. height + 200;
Document. getelementbyid ("fckeditor1 ___ frame"). Height = ofckeditor. height;
}
If (ofckeditor. Height> 1000)
Document. getelementbyid ("btn_upsize"). Disabled = "disabled ";
Document. getelementbyid ("btn_downsize"). Disabled = "";
}
// Reduce the size of the editing area
Function downsize ()
{
VaR Height = ofckeditor. height;
If (Height & gt; 200)
{
Ofckeditor. Height = ofckeditor. Height-200;
Document. getelementbyid ("fckeditor1 ___ frame"). Height = ofckeditor. height;
}
If (ofckeditor. height <400)
Document. getelementbyid ("btn_downsize"). Disabled = "disabled ";
Document. getelementbyid ("btn_upsize"). Disabled = "";
}
// Remove spaces at the beginning and end of a string
String. Prototype. Trim = function ()
{
// Use a regular expression to separate spaces
// Replace it with a null string.
Return this. Replace (/(^ \ s *) | (\ s * $)/g ,"");
}
// Reset the Editor (clear)
Function resetfckeditor ()
{
Fckeditorapi. getinstance ('fckeditor1'). sethtml ("");
}
// Insert HTML code to the current position
Function inserthtml ()
{
VaR htmlstr = Document. getelementbyid ("insertstr"). value;
If (htmlstr. length> 2)
{
Fckeditorapi. getinstance ('fckeditor1'). inserthtml (htmlstr );
}
Document. getelementbyid ("insertstr"). value = "";
}