This article describes the JS integration fckeditor and the method of judging whether the content is empty. Share it for your reference, as follows:
<script type="text/javascript"><!--// Automatically calculates the editor base path based on the _samples directory.// This is useful only for these samples. A real application should use something like this:// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.var sBasePath ='/fckeditor/';var oFCKeditor = new FCKeditor( 'news_content' ) ;oFCKeditor.BasePath = sBasePath ;oFCKeditor.Height = 400 ;oFCKeditor.Width = 600 ;oFCKeditor.Value = '' ;oFCKeditor.Create() ;//-->//Get the length of the fck content function GetMessageLength(str){ var oEditor = FCKeditorAPI.GetInstance(str) ; var oDOM = oEditor.EditorDocument ; var iLength ; if ( document.all ) // If Internet Explorer. { iLength = oDOM.body.innerText.length ; } else // If Gecko. { var r = oDOM.createRange() ; r.selectNodeContents( oDOM.body ) ; iLength = r.toString().length ; }// oEditor.InsertHtml('')return iLength} function CheckPost(){ if(GetMessageLength("news_content")=='0') { alert('Please enter content'); return false; }}//Get fck content function GetMessageContent(str){ var oEditor = FCKeditorAPI.GetInstance(str) ; return oEditor.GetXHTML();}</script>When there is the following config.php configuration:
$Config['UserFilesPath'] = '/upload/' ;$Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png') ;$Config['DeniedExtensions']['Image'] = array() ;$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ;$Config['FileTypesAbsolutePath']['Image'] = ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;When uploading, the quick upload will be uploaded directly to the upload directory.
Non-fast upload will be uploaded to the upload/image directory
When browsing the server
Image browsing will point to upload/image
Therefore, the pictures uploaded quickly cannot be browsed when browsing the server.
PS: Here, the editor recommends several code formatting tools to you, I believe that it can be used in future programming development:
C language style/HTML/CSS/json code formatting and beautification tools:
http://tools.VeVB.COM/code/ccode_html_css_json
Online JavaScript code beautification and formatting tools:
http://tools.VeVB.COM/code/js
JavaScript code beautification/compression/formatting/encryption tools:
http://tools.VeVB.COM/code/jscompress
Online JSON code verification, inspection, beautification and formatting tools:
http://tools.VeVB.COM/code/json
json code online formatting/beautification/compression/editing/converting tools:
http://tools.VeVB.COM/code/jsoncodeformat
For more information about JavaScript, please check this site's special topics: "Summary of Ajax Operation Skills in JavaScript", "Summary of JSON Operation Skills in JavaScript", "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm techniques", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm techniques", "Summary of JavaScript traversal algorithms and techniques", and "Summary of JavaScript mathematical operations usage"
I hope this article will be helpful to everyone's JavaScript programming.