lanye-apurple
三军可以夺帅,匹夫不可夺志也
FreeTextBox使用说明
2008年02月16日 星期六 16:01

1.如何在客户端用JS获取及设置FreeTextBox的内容?

   function getFtb()
   
...
{
       
var html = FTB_API["FreeTextBox1"
].GetHtml();
        alert(html);
    }

//上面是获取FreeTextBox里的值
//
下面是对 FreeTextBox进行赋值操作
   function setFtb()
   
...
{
        
var temp = document.getElementById("Text1"
).value ;
         FTB_API[
"FreeTextBox1"
].SetHtml(temp);
    }

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>
posted on 2008-05-31 10:14  藍旪  阅读(1201)  评论(1编辑  收藏  举报