FreeTextBox使用说明
1.如何在客户端用JS获取及设置FreeTextBox的内容?
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,但是默认图片为叉子 ,如何处理
string str=FreeTextBox1.Text
这样写的,如果Text中有空格
那保存后,显示就是 ?
这是为啥了?
后来把数据库中的这个空格copy出来,转化成ASCII码是:160
原来,utf-8格式只对127以内的ASCII码是直接处理,所以需要进行处理下:
这样的话就没有问题了!
希望给遇到这个问题的同胞们一点帮助!