MajorFreeTextBoxJavaScriptFunctions
Last changed: 64.202.160.65

.

Summary : A List of JavaScript functions developers can use to program against FreeTextBox

Major FreeTextBox JavaScript functions

InsertHtml(html)

Inserts HTML at the current cursor position

 FTB_API['FreeTextBox1'].InsertHtml("blah <i>blah</i>");

SurroundHtml(before,after)

Surrounds the currently selected text (and HTML) with the given strings

 FTB_API['FreeTextBox1'].SurroundHtml("<i>before</i>","<u>after</u>");

GetHtml()

Returns the HTML currently in the editor.

 FTB_API['FreeTextBox1'].GetHtml();

SetHtml(html)

Sets the HTML in the editor

 FTB_API['FreeTextBox1'].SetHtml("some new HTML with a table: <table><tr><td>(0, 0)</td><td>(0, 1)</td></tr><tr><td>(1, 0)</td><td>(1, 1)</td></tr></table>");

ExecuteCommand(commandName, middle, commandValue)

Executes commands based on the MSHTML (for IE) and Midas (for Firefox/Mozilla) specifications

 FTB_API['FreeTextBox1'].GetHtml('bold','','');
 FTB_API['FreeTextBox1'].GetHtml('forecolor','','#ffcc00');

QueryCommandValue(commandName)

Querys the state of the current cursor position

 FTB_API['FreeTextBox1'].GetHtml('forecolor');

Focus()

Sets the focus on the current editor

 FTB_API['FreeTextBox1'].Focus();

SetStyle(className)

Sets the classname of current element or surrounds the current text with <span class="className">text</span>

 FTB_API['FreeTextBox1'].SetStyle(className);

clientSideTextChanged(ftb)

In .NET, set the ClientSideTextChanged property or in JavaScript set

 FTB_API['FreeTextBox1'].clientSideTextChanged = myFunction;
 function myFunction(ftb) {
   // do something with FreeTextBox
 }