夜的第七章

WEB开发个人博客。

« 四叶草便签本 V2.1.1Eclipse智能提示改为中文 »

Js操作FreeTextBox

因为FTB自己有库,所以是需要调用它自己的函数来实现的,常用的操作有:

InsertHtml(html)

用于插入html字符串

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

SurroundHtml(before,after)

两端插入给定的字符串(HTML也可以)。

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

GetHtml()

返回当前编辑器的值(html)。

 FTB_API['FreeTextBox1'].GetHtml();

SetHtml(html)

设置当前编辑器的值(html)。

 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 }

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。



[2007 - 2011] © Leadnt.com