For freetextbox 1.63/2.0.7/3.0rc/3.0

Source: Internet
Author: User

Original Web site: http://www.blogwind.com/Wuvist/comment.aspx? Article _id = 5421

Author: wuvist

Please indicate the source and my name of the original article for the interpreter. Thank you ...... If you need to use the JavaScript function in the text, keep the function name.

Freetextbox should be one of the most widely used free Asp.net controls ......

Freetextbox team calls Ftb: "The No.1 free ASP. net html editor for IE and Mozilla." There is no error at all ......


When I started blogging in last December, I used Ftb 1.6.3 as the background editor. This Ftb version should be the most widely used version in China ......


The biggest advantage of Ftb is that it uses JavaScript to process the text, avoiding the disadvantages that Asp.net controls often need to PostBack the page. In my opinion, it is possible to save the static page generated by Ftb and use it as pure XHTML on servers that do not support Asp.net. However, the project is very large, it seems that no programmer wants to do such a thing ...... After all, there are htmlarea and other things.

At that time, Ftb was open-source and powerful enough ...... The only pity is that Ftb of 1.x does not support Mozilla ...... When I added it to the blog system, I also added the emoticon code style and image insertion function. Although the source code of Ftb is available, from the perspective of usage, I don't think I should modify its C # code when extending the Ftb function ...... Writing new JavaScript directly will be much more flexible ...... I was using something similar:

Function wuvist_code (ftbname ){

If (ftb_ishtmlmode (ftbname) return;

Editor = ftb_getiframe (ftbname );

VaR range = editor.doc ument. selection. createRange ();

VaR rangetype = editor.doc ument. selection. type;

If (rangetype = "text ")

{

Range.exe ccommand ("removeformat ");

VaR rangetext = range.html text;

Range. pastehtml ('<PRE style = "font-size: 90%; font-family: \ 'courier new \', courier, Serif; line-Height: 1em; Background: # eeeeee; margin-top: 1em; margin-bottom: 1em; margin-left: 0px; padding: 5pt; "> '+ rangetext +' </PRE> ');

}

Else if (rangetype = "NONE ")

{

Alert ("You have not selected anything and cannot complete this function! ");

}

Else

{

Alert ("there is a control in the selection part, and the specified text cannot be formatted !! ");

}

}

.

From Ftb 2.0, Mozilla is supported ...... It seems that only the Ftb Editor supports Mozilla ...... Freetextbox team's HTML/CSS/JavaScript skills are really strong ...... 2. The Ftb version of X has made significant changes to JavaScript calls ...... It can be seen that the JavaScript code of 1.x has improved a lot ......

However, Ftb 2.0 starts charging for the source code, and the free version can only be used with the most basic editing functions, the editing functions such as "Clear Word Format" and "Statistical word count" disappear ...... (But I don't know if my idiot won't call them ......)

Because the ftb1.x Image Upload, insertion, and management pages have security risks, 2.x canceled ...... However, the built-in image insertion button is truly fascinating ...... Obviously, image uploading is not supported. Why do we need a function key for browsing ??? Countless users think that it can upload images. on the user's local machine, the Image Browsing effect is also very good ...... Unfortunately, only the user can see it ......

In fact, ftb2.x can also call the image management File Ftb. imagegallery. aspx of 1.x. I use something similar:
Function wuvist_image (){

If (ftb_ishtmlmode ('wtb1 ') return;

Editor = ftb_getiframe ('wtb1 ');

Editor. Focus ();


VaR folder = '<% = user image directory name %> ';

VaR galleryscript = '/Ftb. imagegallery. aspx? Rif = '+ folder +' & CIF = '+ folder;



If (isie ){

Imgarr = showmodaldialog (galleryscript, window, 'dialogwidth: 560px; dialogheight: 500px; help: 0; Status: 0; resizeable: 1 ;');

If (imgarr! = NULL ){

Imagestring = ' ';

Sel = editor.doc ument. selection. createRange ();

Sel. pastehtml (imagestring );

}

} Else {

Alert ("the image upload function only supports IE. ");

}

}

. The code for inserting an emoticon is similar:

Function wuvist_emots (emot ){

If (ftb_ishtmlmode ('wtb1 ') return;



Editor = ftb_getiframe ('wtb1 ');

Editor. Focus ();


If (isie ){

VaR range = editor.doc ument. selection. createRange ();

Range. pastehtml (" ");

} Else {

Selection = editor. Window. getselection ();

Editor. Focus ();

If (selection ){

Range = selection. getrangeat (0 );

} Else {

Range = editor.doc ument. createRange ();

}

Ftb_inserttext ('wtb1 ', " ");

}

}

You can also click "Clear Word Format", "count words", and so on. Because there is no Ftb source code, these new buttons can only be placed outside the Ftb editor. However, this should not be a big problem ...... I also prefer to implement new functions by using pure javacrip.

I am using Ftb 2.0.7 ...... This version of Ftb seems to have encountered an error in parse HTML ...... The insert operation is similar:
<Embed src = http://www.blogwind.com/music.mp3 width = 375 Height = 47 type = audio loop = "1" autostart = "false" controls = "controlpanel, statusbar "console =" clip1 "> </embed>

In HTML, it often removes the URL after "src = http ......

You can see it at the time of reading, but after the submission, Ftb. Text has killed the post-HTTP content ...... I don't know where the bug is ...... This problem also exists in the Ftb used in the blog Park!

The solution I can think of is to upgrade Ftb to version 3.0, and the Mac style is also added to version 3.0, Which is cute ......

However, the original Ftb 3.0 RC version was a disappointing version ...... Why should we integrate all the Javascript/images into the DLL at the good end? Slow ...... Although you can select external source ...... However, it does not provide MAC-style external files ...... The same ...... It also has many bugs ......

Finally ...... Freetextbox team released the new version 3.0 at 12/09/2004 ...... You can use external cirpt/image ...... The new image management File Ftb. imagegallery. aspx is also very useful ...... Looking at its JavaScript code, it is obvious that it has been optimized again, and it is much more concise ...... However, to add the emoticons button yourself, you have to make adjustments. The functions I have written are similar:
Function wuvist_emot (number ){

Ftb = 'wtb1 ';
IMG = ' ';

Window. Parent. ftb_api [Ftb]. inserthtml (IMG );

}

Haha ...... Really concise ......

For Ftb 3.0, I found another very important thing ...... However, out of respect for the copyright of freetextbox team, I will not write it out ...... Maybe freetextbox team intentionally left such a "backdoor ...... It is also very simple. If you are interested, you may wish to study it yourself ...... I used this technique in my blog ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.