经验:
1.如何在客户端用JS获取及设置FreeTextBox的内容?
它提供了Javascript API
获取FTB内容
FTB_API['ctl00_ContentRegion_InputArticle1_FreeTextBox1'].GetHtml();
ctl00_ContentRegion_InputArticle1_FreeTextBox1是FreeTextBox的客户端ID,你可以用
<%
=
FreeTextBox1.ClientID
%>
代替
设置FTB内容
var html ="222";
FTB_API['ctl00_ContentRegion_InputArticle1_FreeTextBox1'].SetHtml(html);
2.如何把FreeTextBox的所有工具按钮显示出来
设置它的
ToolbarLayout属性
ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,
FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat,Insert Date,Insert Time,SelectAll,Preview|JustifyLeft,JustifyRight,JustifyCenter,
JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,
InsertImage,InsertRule,InsertImageFromGallery|Cut,Copy,Paste;Undo,Redo,Print"
至于里面的值如何得到可以参考它官方网站上介绍的特性FreeTextBox 3.0 Features
http://freetextbox.com/features/
直接复制左边的英文介绍
当然如果你是免费用户,是不可能看到全部工具按钮的
3.客户端调用ftb的API函数
FTB_API['ctl00_bcr_FreeTextBox1'].ExecuteCommand('bold');
使字体变为粗体
FTB_API['ctl00_bcr_FreeTextBox1'].ExecuteCommand('italic');
使字体变为斜体
FTB_API['ctl00_bcr_FreeTextBox1'].ExecuteCommand('createlink',null,document.getElementById('LinkUrl').value);"
为文字添加连接
问题1:我想实现自动保存功能,所以想捕获ftb的onTextchange事件在客户端,如何捕获
官方论坛上给出如下解决方案,我式了不行
Property:
ClientSideTextChanged="CharCount"
OR
ClientSideTextChanged="SetTextBox"
Javascript
function CharCount(ftb)
{
var html = ftb.GetHtml();
var o = document.getElementById('charcnt');
o.value = html.length;
window.status = html.length;
}
function SetTextBox(ftb)
{
var html = ftb.GetHtml();
var o = document.getElementById('textwritten');
o.value = ftb.GetHtml();
}
问题2:我设置好了
ImageGalleryPath ,也能弹出
ImageGallery,但是默认图片为叉子 ,如何处理
<
FTB:FreeTextBox
ID
="FreeTextBox1"
runat
="server"
ImageGalleryPath
="/aspnet_client/FreeTextBox/images/"
UseToolbarBackGroundImage
="True"
ButtonSet
="Office2003"
ImageGalleryUrl
="/aspnet_client/FreeTextBox/ftb.imagegallery.aspx?rif={0}&cif={0}"
Language
="zh-CN"
ToolbarLayout
="ParagraphMenu,FontFacesMenu,FontSizesMenu,
FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat,Insert Date,Insert Time,SelectAll,Preview|JustifyLeft,JustifyRight,JustifyCenter,
JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage,
InsertRule,InsertImageFromGallery|Cut,Copy,Paste;Undo,Redo,Print"
Width
="700px"
>
</
FTB:FreeTextBox
>
请有过相关经验的高手指点一下