<script type="text/javascript"> <!-- // FCKeditor_OnComplete is a special function that is called when an editor // instance is loaded ad available to the API. It must be named exactly in // this way. function FCKeditor_OnComplete( editorInstance ) { // Show the editor name and description in the browser status bar. document.getElementById('eMessage').innerHTML = 'Instance "' + editorInstance.Name + '" loaded - ' + editorInstance.Description ; // Show this sample buttons. document.getElementById('eButtons').style.visibility = '' ; }function InsertHTML() { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Check the active editing mode. if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) { // Insert the desired HTML. oEditor.InsertHtml( '- This is some <a href="/Test1.html">sample<\/a> HTML -' ) ; } else alert( 'You must be on WYSIWYG mode!' ) ; }function SetContents() { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Set the editor contents (replace the actual one). oEditor.SetData( 'This is the <b>new content<\/b> I want in the editor.' ) ; }function GetContents() { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Get the editor contents in XHTML. alert( oEditor.GetXHTML( true ) ) ; // "true" means you want it formatted. }function ExecuteCommand( commandName ) { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Execute the command. oEditor.Commands.GetCommand( commandName ).Execute() ; }function GetLength() { // This functions shows that you can interact directly with the editor area // DOM. In this way you have the freedom to do anything you want with it. // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Get the Editor Area DOM (Document object). var oDOM = oEditor.EditorDocument ; var iLength ; // The are two diffent ways to get the text (without HTML ups). // It is browser specific. 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 ; } alert( 'Actual text length (without HTML ups): ' + iLength + ' characters' ) ; }function GetInnerHTML() { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; alert( oEditor.EditorDocument.body.innerHTML ) ; }function CheckIsDirty() { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; alert( oEditor.IsDirty() ) ; }function ResetIsDirty() { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; oEditor.ResetIsDirty() ; alert( 'The "IsDirty" status has been reset' ) ; } --> </script>
<script type="text/javascript">
<!--
// FCKeditor_OnComplete is a special function that is called when an editor
// instance is loaded ad available to the API. It must be named exactly in
// this way.
function FCKeditor_OnComplete( editorInstance )
{
// Show the editor name and description in the browser status bar.
document.getElementById('eMessage').innerHTML = 'Instance "' + editorInstance.Name + '" loaded - ' + editorInstance.Description ; // Show this sample buttons.
document.getElementById('eButtons').style.visibility = '' ;
}function InsertHTML()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Check the active editing mode.
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
{
// Insert the desired HTML.
oEditor.InsertHtml( '- This is some <a href="/Test1.html">sample<\/a> HTML -' ) ;
}
else
alert( 'You must be on WYSIWYG mode!' ) ;
}function SetContents()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Set the editor contents (replace the actual one).
oEditor.SetData( 'This is the <b>new content<\/b> I want in the editor.' ) ;
}function GetContents()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Get the editor contents in XHTML.
alert( oEditor.GetXHTML( true ) ) ; // "true" means you want it formatted.
}function ExecuteCommand( commandName )
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Execute the command.
oEditor.Commands.GetCommand( commandName ).Execute() ;
}function GetLength()
{
// This functions shows that you can interact directly with the editor area
// DOM. In this way you have the freedom to do anything you want with it. // Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; // Get the Editor Area DOM (Document object).
var oDOM = oEditor.EditorDocument ; var iLength ; // The are two diffent ways to get the text (without HTML ups).
// It is browser specific. 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 ;
} alert( 'Actual text length (without HTML ups): ' + iLength + ' characters' ) ;
}function GetInnerHTML()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; alert( oEditor.EditorDocument.body.innerHTML ) ;
}function CheckIsDirty()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
alert( oEditor.IsDirty() ) ;
}function ResetIsDirty()
{
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
oEditor.ResetIsDirty() ;
alert( 'The "IsDirty" status has been reset' ) ;
}
-->
</script>