<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="/Skins/Default/Rss.xsl" ?>
<rss version="2.0">
<channel>
<title>Web : Other</title>
<link>http://dot.net.vn/Desktop.aspx/Threads/OtherWeb/</link>
<description>Code web site by other language</description>
<publisher>Vietnam .NET Community</publisher>
<language>vi-VN</language>
<managingEditor>automail-noreply@dot.net.vn</managingEditor>
<webMaster>automail-noreply@dot.net.vn</webMaster>
<copyright>Copyright 2005-2008 Vietnam .NET Community</copyright>
<pubDate>Sat, 30 Aug 2008 10:42:06 GMT</pubDate>
<category>Web</category>
<ttl>60</ttl>
<docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
<generator>VIE Portal RSS Generator - Version 5.5.3057.24265 - http://www.vieportal.vn/</generator>
<item>
<title>Xây dựng một Rich Text Editor</title>
<link>http://dot.net.vn/Desktop.aspx/Threads/OtherWeb/Xay_dung_mot_Rich_Text_Editor/</link>
<description>Link download&lt;br&gt;http://vsviet.com/Desktop.aspx/dotNET-Libraries/ASP-Components/79D15812448C41CB9858F56D2A11363D/&lt;br&gt;&lt;br&gt;Đã có khá nhiều trình soạn thảo văn bản WYSIWYG miễn phí được share
trên mạng, nhưng nếu bạn là một web developer đích thực, có thể một lúc
nào đó bạn sẽ muốn xây dựng cho riêng mình một Rich Text Editor. Nếu
vậy, bài viết này chắc hẳn sẽ đem lại cho bạn một chút gì đó hữu ích.&lt;br&gt;
&lt;br&gt;
Thoạt tiên, khi nảy ra ý muốn viết 1 cái RTE, tôi đã nghĩ đến việc sử
dụng 1 thẻ DIV để làm khung soạn thảo. Không khó trong việc giả lập con
trỏ nhấp nháy, và chuyển các ký tự từ bàn phím vào trong phần tử DIV
này. Một ví dụ là chương trình mô phỏng giao diện dòng lệnh của Window
mà tôi đặt tên là &lt;a href="http://sacroyantlabs.googlepages.com/cmd.htm" target="_blank"&gt;Web Command Line&lt;/a&gt; (nó chỉ để chơi thôi chứ không giải quyết công việc gì &lt;img src="http://www.ddth.com/images/smilies/emlaugh.gif" alt="" title="Emlaugh" class="inlineimg" border="0"&gt;).&lt;br&gt;
&lt;br&gt;
Nhưng rồi sau nhiều cuộc tìm kiếm, tôi đã phát hiện ra 1 điều quan
trọng khác giúp cho công việc tự đơn giản hóa đi rất nhiều, đó là : &lt;b&gt;DesignMode&lt;/b&gt;.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;DesignMode &lt;/b&gt;là 1 thuộc tính của đối tượng &lt;b&gt;document&lt;/b&gt;, giá trị mặc định của nó là "&lt;i&gt;&lt;b&gt;off&lt;/b&gt;&lt;/i&gt;". Khi bạn sửa đổi giá trị này thành "&lt;i&gt;&lt;b&gt;on&lt;/b&gt;&lt;/i&gt;", hồ sơ web trở thành dạng có thể chỉnh sửa - &lt;i&gt;editable&lt;/i&gt;,
và bạn có thể thao tác với trang web trong cửa sổ như đang làm việc
trên MS Word ! Đây chính là bí quyết để xây dựng nên những RTE cho các
trình duyệt web.&lt;br&gt;
&lt;br&gt;
Bây giờ chúng ta sẽ làm 1 trình soạn thảo WYSIWYG đơn giản, gồm một
trường nhập text, và các nút lệnh cho phép định dạng văn bản &lt;b&gt;in đậm&lt;/b&gt; - &lt;b&gt;B&lt;/b&gt;, &lt;i&gt;in nghiêng&lt;/i&gt; - &lt;i&gt;I&lt;/i&gt;, &lt;u&gt;gạch dưới&lt;/u&gt; - &lt;u&gt;U&lt;/u&gt;.
Ngoài ra, chúng ta cũng thêm vào 2 nút cho phép chèn hình ảnh và liên
kết. Sau cùng là một nút để gỡ bỏ các định dạng. Giao diện của editor
trông sẽ như thế này :&lt;br&gt;
&lt;br&gt;
&lt;img src="http://farm3.static.flickr.com/2278/2142569192_1e4f841419_o.jpg" alt="" onload="NcodeImageResizer.createOn(this);" border="0"&gt;&lt;br&gt;
&lt;br&gt;
Khung soạn thảo là 1 iframe, như cách thường dùng của các RTE. Chúng ta
cho nó 1 ID và dùng CSS để thiết lập kích thước và khả năng scroll :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iframe&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"textArea"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"width:500px;height:240px;overflow:auto;"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iframe&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Để biến vùng iframe này về dạng &lt;i&gt;&lt;font color="Purple"&gt;editable&lt;/font&gt;&lt;/i&gt;, chúng ta thiết lập giá trị của thuộc tính  &lt;b&gt;designMode&lt;/b&gt; thành &lt;i&gt;&lt;b&gt;on&lt;/b&gt;&lt;/i&gt; bằng script sau :&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 98px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getElementById&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'textArea'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;).&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;contentWindow&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;designMode&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'On'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;open&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();
&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;write&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;close&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;&lt;br&gt;
Đoạn code JavaScript này phải được gọi sau khi iframe đã hiện diện trong trang web.&lt;br&gt;
&lt;br&gt;
&lt;i&gt;contentWindow&lt;/i&gt; là 1 thuộc tính của các frames, iframes trong hồ sơ HTML. &lt;br&gt;
&lt;br&gt;
&lt;b&gt;document.getElementById('&lt;i&gt;&lt;font color="Green"&gt;textArea&lt;/font&gt;&lt;/i&gt;').contentWindow&lt;/b&gt; cho phép  tham chiếu đến đối tượng iframe mà định danh được thiết lập : &lt;font color="Navy"&gt;ID&lt;/font&gt; = "&lt;font color="DarkOliveGreen"&gt;textArea&lt;/font&gt;".&lt;br&gt;
&lt;br&gt;
  Trong Mozilla , chúng ta có thể tham chiếu đến 1 đối tượng cửa sổ iframe bằng script :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;window&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;frames&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"myFrame"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;]&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Script tương ứng cho IE là :&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;all&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;myFrame&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;contentWindow&amp;nbsp;
&lt;br&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Còn script mà chúng ta dùng sẽ thích hợp cho cả IE, Mozilla và Opera. &lt;br&gt;
&lt;br&gt;
Như vậy, chúng ta có 1 biến toàn cục &lt;b&gt;editor&lt;/b&gt;, để tham chiếu đến đối tượng document của phần tử iframe giả lập khung soạn thảo văn bản. Dòng lệnh tiếp theo thiết lập &lt;b&gt;designMode&lt;/b&gt; của nó thành "&lt;b&gt;on&lt;/b&gt;". Các lệnh &lt;b&gt;&lt;i&gt;open&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;write&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;close&lt;/i&gt;&lt;/b&gt; chèn vào iframe các tags cơ bản của 1 hồ sơ HTML, những gì nằm giữa &lt;font color="Purple"&gt;&amp;lt;body&amp;gt;&lt;/font&gt; và &lt;font color="Purple"&gt;&amp;lt;/body&amp;gt;&lt;/font&gt; sẽ hiển thị trên khung soạn thảo như phần text mặc định của Editor.&lt;br&gt;
&lt;br&gt;
Sau thiết lập &lt;b&gt;designMode&lt;/b&gt;  = "&lt;i&gt;&lt;b&gt;on&lt;/b&gt;&lt;/i&gt;", đối tượng &lt;i&gt;document&lt;/i&gt;
của iframe sẽ tự kích hoạt một số phương thức hỗ trợ thực hiện định
dạng phần văn bản được chọn (selected text) bên trong nó. Chúng bao gồm
: &lt;br&gt;
&lt;ul&gt;&lt;li&gt;&lt;i&gt;queryCommandEnabled&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;queryCommandIndeterm&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;queryCommandState&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;queryCommandSupported&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;queryCommandValue&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br&gt;
Trong đó, quan trọng hơn cả là 2 phương thức &lt;b&gt;&lt;i&gt;execCommand&lt;/i&gt;&lt;/b&gt; và &lt;i&gt;&lt;b&gt;queryCommandEnabled&lt;/b&gt;&lt;/i&gt;.&lt;br&gt;
&lt;br&gt;
Syntax của &lt;b&gt;execCommand&lt;/b&gt; như sau :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;editableDocument&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sCommand&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;bUserInterface&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;]&amp;nbsp;[,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;vValue&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;])&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Nếu không có text được chọn, phương thức này không làm gì cả.&lt;br&gt;
&lt;br&gt;
Tham số bắt buộc &lt;font color="Blue"&gt;sCommand&lt;/font&gt; là 1 chuỗi tên lệnh định dạng (&lt;i&gt;command identifiers&lt;/i&gt;), chẳng hạn "&lt;i&gt;bold&lt;/i&gt;", "&lt;i&gt;italic&lt;/i&gt;"...  &lt;a href="http://http//www.quirksmode.org/" target="_blank"&gt;QuirksMode&lt;/a&gt;  liệt kê khá chi tiết những lệnh định dạng này, và cả cách chúng làm việc trong từng trình duyệt :&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.quirksmode.org/dom/execCommand.html" target="_blank"&gt;http://www.quirksmode.org/dom/execCommand.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Tham số thứ hai, &lt;font color="Blue"&gt;bUserInterface&lt;/font&gt;, thuộc dạng tùy chọn và mang 1 giá trị &lt;i&gt;&lt;b&gt;boolean&lt;/b&gt;&lt;/i&gt; (mặc định : &lt;i&gt;false&lt;/i&gt;). Trong Mozilla, nếu đặt là &lt;i&gt;true&lt;/i&gt;, bạn có thể nhận 1 lỗi (NS_ERROR_NOT_IMPLEMENTED). &lt;br&gt;
&lt;br&gt;
Tham số thứ 3,  &lt;font color="Blue"&gt;vValue&lt;/font&gt;, cũng thuộc dạng
tùy chọn. Bạn sẽ phải dùng đến nó trong một số trường hợp mà tham số
đầu tiên cần 1 giá trị cụ thể. Chẳng hạn khi muốn định dạng màu chữ,
tham số thứ nhất sẽ là "&lt;i&gt;&lt;font color="Sienna"&gt;forecolor&lt;/font&gt;&lt;/i&gt;", và chúng ta cần tham số thứ 3 để cho trình duyệt biết màu gì sẽ được sử dụng. Ví dụ :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;editableDocument&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"forecolor"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"#0000ff"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Hoặc khi chèn 1 hình ảnh, tham số thứ nhất sẽ là "&lt;i&gt;&lt;font color="Sienna"&gt;insertimage&lt;/font&gt;&lt;/i&gt;", và tham số thứ 3 cho biết đường dẫn của hình ảnh đó :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;editableDocument&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'insertimage'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;imageURL&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Để biết 1 command có thể thực thi hay không, chúng ta dùng
queryCommandEnabled. Phương thức này nhận 1 tham số là tên của command
(như : "&lt;font color="Sienna"&gt;&lt;i&gt;bold&lt;/i&gt;&lt;/font&gt;", "&lt;i&gt;&lt;font color="Sienna"&gt;italic&lt;/font&gt;&lt;/i&gt;", "&lt;i&gt;&lt;font color="Sienna"&gt;forecolor&lt;/font&gt;&lt;/i&gt;", "&lt;i&gt;&lt;font color="Sienna"&gt;insertimage&lt;/font&gt;&lt;/i&gt;"...),
và trả về 1 giá trị boolean cho biết khả năng thi hành command đó.
Thông thường chúng ta kiểm tra command trước khi gọi nó. Script dưới
đây kiểm tra command tạo liên kết, nếu có thể thực hiện thì sẽ chèn vào
khung soạn thảo 1 HyperLink (&lt;b&gt;aLink&lt;/b&gt;) :&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 66px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editableDocument&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;queryCommandEnabled&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"createlink"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editableDocument&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'createlink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt; Bây giờ, chúng ta xem xét các button. Chúng là những hình ảnh mà
bạn tùy ý trình bày sao cho hợp lý. Thông thường các button định dạng
nằm ngay trên khung soạn thảo như trong ví dụ mẫu này. Các lệnh in đậm,
in nghiêng, gạch dưới được liên kết với hàm &lt;b&gt;doFormat&lt;/b&gt; qua sự kiện &lt;i&gt;click&lt;/i&gt; :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 66px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"bold.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"doFormat('bold');"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"italic.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"doFormat('italic');"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"underline.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"doFormat('underline');"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;    Hàm &lt;b&gt;doFormat&lt;/b&gt; như sau :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 114px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;queryCommandEnabled&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(!&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;}
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;    Như vậy, &lt;b&gt;doFormat&lt;/b&gt; nhận vào 2 tham số :&lt;br&gt;
&lt;br&gt;
     - &lt;b&gt;a &lt;/b&gt;: tên của command&lt;br&gt;
     - &lt;b&gt;b &lt;/b&gt;: giá trị của command&lt;br&gt;
&lt;br&gt;
    Ở đây, editor là biến toàn cục đã định nghĩa bên ngoài hàm như trình bày phía trên. Khi được gọi, &lt;b&gt;doFormat&lt;/b&gt; sử dụng phương thức &lt;i&gt;&lt;b&gt;queryCommandEnabled&lt;/b&gt;&lt;/i&gt; của editor để kiểm tra khả năng thực thi command &lt;b&gt;a&lt;/b&gt;. Sau đó, tiếp tục kiểm tra tham số thứ 2, nếu không thấy thì gán cho nó giá trị &lt;i&gt;&lt;font color="DarkOrchid"&gt;null&lt;/font&gt;&lt;/i&gt;. Nếu có thể thực thi command thì gọi phương thức &lt;b&gt;&lt;i&gt;execCommand&lt;/i&gt;&lt;/b&gt;.&lt;br&gt;
&lt;br&gt;
    Đối với việc chèn hình ảnh và liên kết, có một chút khác biệt, chúng ta viết 2 hàm &lt;b&gt;addLink&lt;/b&gt; và &lt;b&gt;insertImage&lt;/b&gt; dành riêng cho nhiệm vụ này. Chúng được gọi theo cách tương tự như  3 nút lệnh trước.&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 50px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"image.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"insertImage();"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"link.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"addLink();"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;    Trong IE, bạn có thể viết :&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"CreateLink"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;    Hoặc :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"InsertImage"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;    Trình duyệt này sẽ hiển thị một hộp thoại để người sử dụng nhập vào các tham số thích hợp :&lt;br&gt;
&lt;br&gt;
&lt;img src="http://farm3.static.flickr.com/2014/2143437544_9b83c775e1_o.jpg" alt="" onload="NcodeImageResizer.createOn(this);" border="0"&gt;&lt;br&gt;
&lt;br&gt;
&lt;img src="http://farm3.static.flickr.com/2225/2143456580_e53ca630eb_o.jpg" alt="" onload="NcodeImageResizer.createOn(this);" border="0"&gt;&lt;br&gt;
&lt;br&gt; Tuy nhiên tính năng này chưa được Mozilla và Opera hỗ trợ, vì vậy,
một số người lập trình Rich Text Editor đã tự xây dựng các kiểu
DialogBox riêng để thay thế. Việc đó không khó, nhưng trong bài viết
này, chúng ta sẽ đơn giản hóa công việc bằng 1 hộp thoại &lt;i&gt;prompt&lt;/i&gt;.&lt;br&gt;
&lt;br&gt;
 &lt;br&gt;
Dưới đây là hàm &lt;b&gt;addLink&lt;/b&gt; :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 114px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;addLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(){
&lt;br&gt;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prompt&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Enter&amp;nbsp;or&amp;nbsp;paste&amp;nbsp;a&amp;nbsp;link&amp;nbsp;:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;''&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'CreateLink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Và hàm &lt;b&gt;insertImage&lt;/b&gt; :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 130px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;insertImage&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getElementById&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'textArea'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;).&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;contentWindow&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;focus&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();
&lt;br&gt;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iURL&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prompt&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Enter&amp;nbsp;or&amp;nbsp;paste&amp;nbsp;a&amp;nbsp;URL&amp;nbsp;:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;''&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iURL&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'InsertImage'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iURL&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Khi người sử dụng click trên nút [&lt;img src="http://sacroyantlabs.googlepages.com/link.gif" alt="" onload="NcodeImageResizer.createOn(this);" border="0"&gt;], một hộp thoại &lt;i&gt;prompt&lt;/i&gt; bật ra để họ nhập chuỗi siêu liên kết. Hàm &lt;b&gt;addLink&lt;/b&gt; kiểm tra lại chuỗi này, nếu có giá trị thị gọi &lt;b&gt;doFormat&lt;/b&gt; với&lt;br&gt;
2 tham số : "&lt;i&gt;&lt;font color="Purple"&gt;CreateLink&lt;/font&gt;&lt;/i&gt;" - tên command, và  &lt;font color="Blue"&gt;aLink&lt;/font&gt; - URL đích do người dùng cung cấp.&lt;br&gt;
&lt;br&gt;
Khi hàm &lt;b&gt;insertImage&lt;/b&gt; được gọi, chúng ta sử dụng dòng lệnh đầu tiên để &lt;i&gt;focus&lt;/i&gt;
vào vùng soạn thảo. (Điều này là cần thiết cho trình duyệt IE, bạn thử
bỏ đi và chạy thử chương trình thì sẽ hiểu tại sao !). Tiếp đó, 1 hộp
thoại &lt;i&gt;prompt&lt;/i&gt;  mở ra yêu cầu người sử dụng nhập vào URL của hình ảnh. Cuối cùng, chúng ta gọi &lt;b&gt;doFormat&lt;/b&gt; với command "&lt;font color="Purple"&gt;&lt;i&gt;InsertImage&lt;/i&gt;&lt;/font&gt;" và giá trị &lt;font color="Blue"&gt;iURL&lt;/font&gt; mà người dùng đã nhập.&lt;br&gt;
&lt;br&gt;
Nút lệnh [&lt;img src="http://sacroyantlabs.googlepages.com/removeformatting.gif" alt="" onload="NcodeImageResizer.createOn(this);" border="0"&gt;] cho phép gỡ bỏ mọi định dạng trên phần text được chọn.&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"removeformatting.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"unformat();"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Chúng ta viết hàm xử lý như sau :&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 82px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;unformat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'removeformat'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'unlink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Không có gì để giải thích nhiều. Command "&lt;i&gt;&lt;font color="Purple"&gt;removeformat&lt;/font&gt;&lt;/i&gt;" loại bỏ toàn bộ các thiết lập kiểu dáng văn bản. Command "&lt;font color="Purple"&gt;&lt;i&gt;unlink&lt;/i&gt;&lt;/font&gt;" gỡ bỏ liên kết cho phần văn bản đó.&lt;br&gt;
&lt;br&gt;
Cuối cùng, chúng ta có toàn bộ mã HTML và JavaScript như dưới đây  :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 498px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;h1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;Rich&amp;nbsp;Text&amp;nbsp;Editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;h1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;table&amp;nbsp;border&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"0"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;cellpadding&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"0"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;cellspacing&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"1"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;bgcolor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"#e1f2ff"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&amp;nbsp;height&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"20"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;amp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;nbsp&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"bold.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Bold"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"doFormat('bold');"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"italic.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Italic"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"doFormat('italic');"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"underline.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Underline"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"doFormat('underline');"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"image.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Insert&amp;nbsp;Image"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"insertImage();"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"link.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Hyperlink"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"addLink();"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"removeformatting.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Remove&amp;nbsp;Formatting"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onclick&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"unformat();"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&amp;nbsp;align&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"center"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;bgcolor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"#ffffff"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iframe&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"textArea"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"width:500px;height:240px;overflow:auto;"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iframe&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;table&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;script&amp;nbsp;type&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"text/javascript"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getElementById&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'textArea'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;).&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;contentWindow&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;designMode&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'On'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;open&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;write&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;close&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;br&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){
&lt;br&gt;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;queryCommandEnabled&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(!&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;}
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;}
&lt;br&gt;}
&lt;br&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;addLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(){
&lt;br&gt;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prompt&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Enter&amp;nbsp;or&amp;nbsp;paste&amp;nbsp;a&amp;nbsp;link&amp;nbsp;:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;''&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'CreateLink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;br&gt;}
&lt;br&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;insertImage&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(){
&lt;br&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getElementById&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'textArea'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;).&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;contentWindow&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;focus&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();
&lt;br&gt;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prompt&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Enter&amp;nbsp;or&amp;nbsp;paste&amp;nbsp;a&amp;nbsp;URL&amp;nbsp;:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;''&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'InsertImage'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;br&gt;}
&lt;br&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;unformat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(){
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'removeformat'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'unlink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;}
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Bây giờ thì Editor của chúng ta đã có thể hoạt động trên Mozilla, IE, Opera và Safari.&lt;br&gt;&lt;div class="smallfont"&gt;
				
				&lt;strong&gt;Những command thường dùng&lt;/strong&gt;
			&lt;/div&gt;
			&lt;hr style="color: rgb(252, 252, 252);" size="1"&gt;
			&lt;!-- / icon and title --&gt;
		
		
		&lt;!-- message --&gt;
		&lt;div id="post_message_976284"&gt;&lt;b&gt;Định dạng  văn bản tại chỗ :&lt;/b&gt;&lt;br&gt;
&lt;br&gt;
&lt;i&gt;&lt;b&gt;bold &lt;/b&gt;&lt;/i&gt;: in đậm text&lt;br&gt;
&lt;i&gt;&lt;b&gt;fontname&lt;/b&gt;&lt;/i&gt; : font chữ, &lt;font color="Blue"&gt;vValue&lt;/font&gt; :tên font. VD : arial, verdana...&lt;br&gt;
&lt;i&gt;&lt;b&gt;fontsize&lt;/b&gt;&lt;/i&gt; : khổ chữ, &lt;font color="Blue"&gt;vValue&lt;/font&gt;  : các số từ 1 đến 7.&lt;br&gt;
&lt;i&gt;&lt;b&gt;forecolor&lt;/b&gt;&lt;/i&gt; : màu chữ. &lt;font color="Blue"&gt;vValue&lt;/font&gt; : chuỗi tên hoặc mã màu. VD : #0000ff, navy...&lt;br&gt;
&lt;i&gt;&lt;b&gt;hilitecolor&lt;/b&gt;&lt;/i&gt; : màu nền (1). &lt;font color="Blue"&gt;vValue&lt;/font&gt; : chuỗi tên hoặc mã màu. VD : #0000ff, navy...&lt;br&gt;
&lt;i&gt;&lt;b&gt;italic &lt;/b&gt;&lt;/i&gt;: làm nghiêng text&lt;br&gt;
&lt;i&gt;&lt;b&gt;subscript&lt;/b&gt;&lt;/i&gt; : text thấp xuống so với bình thường&lt;br&gt;
&lt;i&gt;&lt;b&gt;superscript&lt;/b&gt;&lt;/i&gt; : đẩy text lên cao hơn bình thường&lt;br&gt;
&lt;i&gt;&lt;b&gt;underline&lt;/b&gt;&lt;/i&gt; : gạch dưới text&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Định dạng khối văn bản :&lt;/b&gt;&lt;br&gt;
&lt;br&gt;
&lt;b&gt;&lt;i&gt;heading &lt;/i&gt;&lt;/b&gt;: Định dạng cho một tiêu đề. &lt;font color="Blue"&gt;vValue&lt;/font&gt; : &amp;lt;h1&amp;gt;, &amp;lt;h2&amp;gt;, &amp;lt;h3&amp;gt;, &amp;lt;h4&amp;gt;, &amp;lt;h5&amp;gt;, &amp;lt;h6&amp;gt;.&lt;br&gt;
&lt;b&gt;&lt;i&gt;indent&lt;/i&gt;&lt;/b&gt; : cho khối văn bản lui vào 1 tab&lt;br&gt;
&lt;b&gt;&lt;i&gt;insertorderedlist&lt;/i&gt;&lt;/b&gt; : liệt kê theo số thứ tự&lt;br&gt;
&lt;b&gt;&lt;i&gt;insertunorderedlist&lt;/i&gt;&lt;/b&gt; : liệt kê không đánh số.&lt;br&gt;
&lt;b&gt;&lt;i&gt;justifycenter &lt;/i&gt;&lt;/b&gt;: căn giữa&lt;br&gt;
&lt;b&gt;&lt;i&gt;justifyfull&lt;/i&gt;&lt;/b&gt; : dàn đều 2 biên&lt;br&gt;
&lt;b&gt;&lt;i&gt;justifyleft&lt;/i&gt;&lt;/b&gt; : căn trái&lt;br&gt;
&lt;b&gt;&lt;i&gt;justifyright&lt;/i&gt;&lt;/b&gt; : căn phải&lt;br&gt;
&lt;b&gt;&lt;i&gt;outdent&lt;/i&gt;&lt;/b&gt; : cho khối văn bản lui ra 1 tab&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Các command khác :&lt;/b&gt;&lt;br&gt;
&lt;br&gt;
&lt;i&gt;&lt;b&gt;createlink&lt;/b&gt;&lt;/i&gt; : tạo liên kết. &lt;font color="Blue"&gt;vValue&lt;/font&gt; : chuỗi URL&lt;br&gt;
&lt;i&gt;&lt;b&gt;delete&lt;/b&gt;&lt;/i&gt; : xóa phần selection&lt;br&gt;
&lt;i&gt;&lt;b&gt;inserthorizontalrule&lt;/b&gt;&lt;/i&gt; : chèn vào 1 phần tử &amp;lt;hr&amp;gt;&lt;br&gt;
&lt;i&gt;&lt;b&gt;inserthtml&lt;/b&gt;&lt;/i&gt; : chèn vào 1 chuỗi HTML (2)&lt;br&gt;
&lt;i&gt;&lt;b&gt;insertimage&lt;/b&gt;&lt;/i&gt; : chèn hình ảnh. &lt;font color="Blue"&gt;vValue&lt;/font&gt; : đường dẫn đến file ảnh.&lt;br&gt;
&lt;i&gt;&lt;b&gt;removeformat&lt;/b&gt;&lt;/i&gt; : loại bỏ các định dạng ở phần selection.&lt;br&gt;
&lt;i&gt;&lt;b&gt;unlink&lt;/b&gt;&lt;/i&gt; : loại bỏ liên kết ở phần selection.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Các command điều khiển editor :&lt;/b&gt;&lt;br&gt;
&lt;br&gt;
&lt;i&gt;&lt;b&gt;undo&lt;/b&gt;&lt;/i&gt; : khôi phục lại tình trạng trước khi có 1 thay đổi được ghi nhận (3)&lt;br&gt;
&lt;i&gt;&lt;b&gt;redo &lt;/b&gt;&lt;/i&gt;: khôi phục lại tình trạng trước khi undo 1 bước.&lt;br&gt;
&lt;i&gt;&lt;b&gt;selectall&lt;/b&gt;&lt;/i&gt; : chọn toàn bộ nội dung editor.&lt;br&gt;
&lt;br&gt;
Danh sách trên chưa đầy đủ, nhưng là những gì cơ bản nhất cho 1 trình
soạn thảo văn bản. Chúng là các commands nhận được sự hỗ trợ chung của
nhiều trình duyệt.&lt;br&gt;
&lt;br&gt;
Nhắc lại cú pháp của &lt;b&gt;execCommand&lt;/b&gt; :&lt;br&gt;
&lt;br&gt;
&lt;i&gt;&lt;font color="DarkRed"&gt;editableDocument&lt;/font&gt;&lt;/i&gt;.&lt;b&gt;execCommand&lt;/b&gt;(&lt;font color="Blue"&gt;&lt;b&gt;sCommand&lt;/b&gt;&lt;/font&gt; [, &lt;font color="SeaGreen"&gt;bUserInterface&lt;/font&gt;] [, &lt;font color="SeaGreen"&gt;vValue&lt;/font&gt;])&lt;br&gt;
&lt;br&gt;
Trong đó :&lt;br&gt;
&lt;font color="Blue"&gt;&lt;br&gt;
editableDocument&lt;/font&gt; : tên biến tham chiếu đến phần tử document của đối tượng iframe được dùng để giả lập khung soạn thảo.&lt;br&gt;
&lt;font color="Blue"&gt;sCommand&lt;/font&gt; : chuỗi tên command. Không phân biệt hoa -  thường.&lt;br&gt;
&lt;font color="Blue"&gt;bUserInterface &lt;/font&gt;: biến tùy chọn hiển thị các DialogBox. Luôn thiết lập là &lt;i&gt;false&lt;/i&gt; để tránh lỗi trong Mozilla và Opera.&lt;br&gt;
&lt;font color="Blue"&gt;vValue&lt;/font&gt; : giá trị cho command. Nếu command không cần chỉ định giá trị, sử dụng &lt;i&gt;&lt;b&gt;null&lt;/b&gt;&lt;/i&gt;.&lt;br&gt;
&lt;br&gt;
Thông thường &lt;font color="Blue"&gt;vValue&lt;/font&gt; là 1 chuỗi, ngoại trừ giá trị cho kích thước chữ có thể để dạng &lt;i&gt;&lt;b&gt;interger&lt;/b&gt;&lt;/i&gt;, nhưng nói chung vẫn nên đưa về kiểu &lt;i&gt;&lt;b&gt;string&lt;/b&gt;&lt;/i&gt;.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;&lt;font color="Red"&gt;*&lt;/font&gt; Chú thích :&lt;/b&gt;&lt;br&gt;
&lt;ol style="list-style-type: decimal;"&gt;&lt;li&gt;Với IE, cần thay bằng command &lt;i&gt;&lt;b&gt;backcolor&lt;/b&gt;&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;Chỉ duy nhất Mozilla hỗ trợ command này. Với IE, có thể dùng các command cụ thể cho từng đối tượng muốn chèn, như : &lt;i&gt;InsertInputButton&lt;/i&gt;, &lt;i&gt;InsertTextArea&lt;/i&gt;, &lt;i&gt;InsertMarquee&lt;/i&gt;... &lt;a href="http://msdn2.microsoft.com/en-us/library/ms533049%28VS.85%29.aspx" target="_blank"&gt;Xem thêm tại đây&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Các thay đổi được ghi nhận có thể là bất cứ hành động nào làm khác
đi nội dung vốn có trong Editor, chẳng hạn như việc gõ vào, xóa đi, hay
đổi màu 1 ký tự... &lt;i&gt;&lt;b&gt;Undo&lt;/b&gt;&lt;/i&gt; và &lt;i&gt;&lt;b&gt;Redo&lt;/b&gt;&lt;/i&gt; chỉ làm việc hoàn hảo trong Mozilla.&lt;/li&gt;&lt;/ol&gt;FireFox 3 đã hỗ trợ thuộc tính &lt;i&gt;&lt;b&gt;contentEditable&lt;/b&gt;&lt;/i&gt;. Như vậy có nghĩa là với IE 5+ và FireFox 3, chúng ta có thể gõ text trên bất cứ phần tử nào, sau khi thiết lập giá trị &lt;b&gt;&lt;font color="Blue"&gt;true&lt;/font&gt;&lt;/b&gt; cho thuộc tính &lt;i&gt;&lt;b&gt;contentEditable&lt;/b&gt;&lt;/i&gt; của nó. Ví dụ :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 130px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;div&amp;nbsp;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;contenteditable&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"true"&amp;nbsp;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"width:500px;height:200px;border:1px&amp;nbsp;inset&amp;nbsp;black;&amp;nbsp;overflow:auto;"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;Có&amp;nbsp;thể&amp;nbsp;xử&amp;nbsp;lý&amp;nbsp;văn&amp;nbsp;bản&amp;nbsp;ở&amp;nbsp;đây&amp;nbsp;như&amp;nbsp;trong&amp;nbsp;textArea
&lt;br&gt;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;div&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Và việc làm 1 WYSIWYG Editor sẽ trở nên dễ dàng hơn nữa :&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 194px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;script&amp;nbsp;language&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"javascript"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;doFormat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;cmd&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)&amp;nbsp;{
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;cmd&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;lt;/script&amp;gt;
&lt;br&gt;&lt;/span&gt;&amp;lt;button&amp;nbsp;onclick="doFormat('bold');"&amp;gt;&amp;lt;b&amp;gt;B&amp;lt;/b&amp;gt;&amp;lt;/button&amp;gt;&amp;lt;BR&amp;gt;
&lt;br&gt;&amp;lt;div&amp;nbsp;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;contenteditable="true"&amp;nbsp;
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;style="width:500px;height:200px;border:1px&amp;nbsp;inset&amp;nbsp;black;&amp;nbsp;overflow:auto;"&amp;gt;
&lt;br&gt;
&lt;br&gt;&amp;lt;/div&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;&lt;a href="http://starkravingfinkle.org/blog/wp-content/uploads/2007/07/contenteditable.htm" target="_blank"&gt;&lt;/a&gt;&lt;br&gt;&lt;div class="smallfont"&gt;
				
				&lt;strong&gt;Viết class cho editor&lt;/strong&gt;
			&lt;/div&gt;
			&lt;hr style="color: rgb(252, 252, 252);" size="1"&gt;
			&lt;!-- / icon and title --&gt;&lt;!-- message --&gt;
		
		
		
		Khi nắm được những khái niệm xung quanh thuộc tính &lt;i&gt;&lt;b&gt;designMode&lt;/b&gt;&lt;/i&gt; và phương thức &lt;i&gt;&lt;b&gt;execCommand&lt;/b&gt;&lt;/i&gt;,
việc xây dựng Rich Text Format Editor không còn là điều khó khăn nữa.
Có lẽ những bạn nào mà qua topic này, lần đầu tiên nghe nói đến các
khái niệm trên, sẽ có cùng cảm giác như vậy. Hiểu được vấn đề là giải
quyết được vấn đề.&lt;br&gt;
&lt;br&gt;
Các trình WYSIWYG xây dựng sẵn thường khá cồng kềnh. Chúng càng cố
khoác lên mình dáng vẻ của các ứng dụng soạn thảo văn bản desktop thì
hình thức càng rườm rà, bề bộn, với những tính năng mà có thể chúng ta
không bao giờ dùng đến.&lt;br&gt;
&lt;br&gt;
Đây là một số trình soạn thảo WYSIWYG phổ biến :&lt;br&gt;
&lt;blockquote&gt;    * &lt;a href="http://www.freerichtexteditor.com/page/3.htm" target="_blank"&gt;Free Rich Text Editor&lt;/a&gt;&lt;br&gt;
    * &lt;a href="http://www.solmetra.com/en/disp.php/en_products/en_spaw/en_spaw_demo" target="_blank"&gt;SPAW Editor&lt;/a&gt;&lt;br&gt;
    * &lt;a href="http://xinha.webfactional.com/" target="_blank"&gt;Xinha&lt;/a&gt;&lt;br&gt;
    * &lt;a href="http://koivi.com/WYSIWYG-Editor/" target="_blank"&gt;Through-The-Web Editor&lt;/a&gt;&lt;br&gt;
    * &lt;a href="http://kevinroth.com/rte/demo.htm" target="_blank"&gt;Cross-Browser Rich Text Editor&lt;/a&gt; &lt;/blockquote&gt;Các
Editor cũng giống như mọi ứng dụng nền web, đều có hạn chế là phải phụ
thuộc vào mức độ hỗ trợ của các trình duyệt. Một ứng dụng web có thể
hoạt động trong nhiều trình duyệt khác nhau, không có lỗi khi chạy, và
ít rắc rối, thì dễ gây cảm tình hơn những trò hoa lá.&lt;br&gt;
&lt;br&gt;
Về phía những editor mà các dịch vụ web sử dụng thì cái của &lt;a href="http://mail.google.com/" target="_blank"&gt;Gmail&lt;/a&gt;
hợp với mỹ cảm của tôi hơn cả. Ở đó có sự hài hòa giữa tính đơn giản,
vẻ đẹp trang nhã và khả năng hoạt động chuẩn xác, hoàn hảo. &lt;br&gt;
&lt;br&gt;
Do bài viết này chỉ nhằm mục đích giới thiệu cách xây dựng trình soạn
thảo WYSIWYG, nên chúng ta vẫn giữ nguyên hình thức của bản trước mà
không cần thêm các nút lệnh định dạng khác trên toolBar, tránh làm phức
tạp vấn đề.&lt;br&gt;
&lt;br&gt;
Chúng ta mở đầu bằng đoạn script  :&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 402px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;RTE&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;isIE&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;all&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;?&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;isMz&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;navigator&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;appName&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;==&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Netscape'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)?&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&lt;br&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;rel&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getElementById&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)||&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;}&lt;br&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setHTML&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sHTML&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;rel&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;rel&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;).&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;innerHTML&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sHTML&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;&amp;nbsp;&amp;nbsp;else{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;alert&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'The&amp;nbsp;element&amp;nbsp;"'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'"&amp;nbsp;not&amp;nbsp;found&amp;nbsp;!'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;}&lt;br&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;btnID&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;Action&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;rel&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;btnID&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;addEventListener&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;addEventListener&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'click'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;new&amp;nbsp;Function(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;Action&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;),&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&amp;nbsp;if&amp;nbsp;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;attachEvent&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;el&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;attachEvent&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'onclick'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;new&amp;nbsp;Function(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;Action&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;));&amp;nbsp;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;&lt;b&gt;rel&lt;/b&gt; trả về phần tử dựa trên id của nó. &lt;b&gt;setHTML&lt;/b&gt; có nhiệm vụ gán code HTML vào 1 phần tử nào đó.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;setBtnAction&lt;/b&gt; chỉ định 1 hành động cho 1 button dưới sự kiện &lt;i&gt;&lt;b&gt;click&lt;/b&gt;&lt;/i&gt;. Hàm này nhận vào 2 tham số : ID của button và chuỗi tên hành động. Ví dụ chúng ta có button &lt;font color="Purple"&gt;btnBold&lt;/font&gt; hiện diện dưới dạng 1 icon nhỏ :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"btnBold"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"bold.gif"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Bold"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Nếu muốn chương trình thực thi lệnh &lt;b&gt;doFomat&lt;/b&gt;&lt;i&gt;&lt;b&gt;(&lt;/b&gt;&lt;/i&gt;"&lt;font color="Purple"&gt;bold&lt;/font&gt;"&lt;i&gt;&lt;b&gt;)&lt;/b&gt;&lt;/i&gt;, khi click vào hình ảnh này,  chúng ta chỉ việc gọi hàm :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'btnBold'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'doFormat("bold")'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Khi chuỗi  '&lt;font color="DarkGreen"&gt;doFormat("bold")&lt;/font&gt;' được truyền  vào hàm &lt;b&gt;setBtnAction&lt;/b&gt;, vì &lt;b&gt;&lt;i&gt;addEventListener&lt;/i&gt;&lt;/b&gt; và &lt;b&gt;&lt;i&gt;attachEvent&lt;/i&gt;&lt;/b&gt; bắt buộc tham số thứ 2 phải là 1 hàm, nên &lt;b&gt;setBtnAction&lt;/b&gt; sẽ  dùng chuỗi này để tạo ra 1 đối tượng &lt;font color="Blue"&gt;Function&lt;/font&gt; với toán tử &lt;i&gt;&lt;b&gt;new&lt;/b&gt;&lt;/i&gt;.&lt;br&gt;
&lt;br&gt;
Giữ nguyên các thành phần điều khiển Editor như cũ, chúng ta viết lại code HTML :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 306px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;table&amp;nbsp;border&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"0"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;cellpadding&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"0"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;cellspacing&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"1"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;bgcolor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"#e1f2ff"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&amp;nbsp;height&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"20"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;amp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;nbsp&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"btnBold"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"bold.gif"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"btnItalic"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"italic.gif"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"btnUnderline"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"underline.gif"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"btnInsertImage"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"image.gif"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"btnAddLink"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"link.gif"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;img&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"btnUnformat"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;src&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"removeformatting.gif"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&amp;nbsp;align&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"center"&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;bgcolor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"#ffffff"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;span&amp;nbsp;id&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"wysiwyg"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;span&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;td&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;tr&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;table&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Thay vì nhúng các hàm vào từng button, chúng ta đã cho mỗi hình ảnh một giá trị  ID.&lt;br&gt;
&lt;br&gt;
Nếu hình dung điều khiển WYSIWYG của chúng ta như 1 đối tượng, nó có
thể mang các thuộc tính căn bản như : tên, kích thước vùng làm việc,
nội dung bên trong. Và bên cạnh đó là 1 loạt các phương thức thi hành
việc định dạng văn bản : chèn link, chèn hình ảnh... Đây là hàm dựng :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 402px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;RichTextEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sID&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;oContain&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sDefaultText&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iWidth&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iHeight&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;ID&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sID&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;content&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sDefaultText&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;width&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iWidth&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;300&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;?&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iWidth&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;500&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;height&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iHeight&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;80&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;?&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;iHeight&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;200&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'&amp;lt;iframe&amp;nbsp;id="'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;ID&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'"&amp;nbsp;style="width:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;width&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'px;height:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;height&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'px;overflow:auto;"&amp;gt;&amp;lt;/iframe&amp;gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setHTML&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;oContain&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;sEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;UI&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getElementById&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;ID&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;).&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;contentWindow&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;UI&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;document&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;with&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;designMode&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'On'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;open&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;write&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;content&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;close&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Các tham số :&lt;br&gt;
&lt;br&gt;
&lt;font color="Purple"&gt;sID&lt;/font&gt; : chuỗi tên riêng cho mỗi Editor, bằng cách này, chúng ta có thể sử dụng nhiều Editor trên cùng 1 trang web.&lt;br&gt;
&lt;font color="Purple"&gt;oContain&lt;/font&gt; : phần tử chứa Editor mà khung soạn thảo sẽ được tạo ra bên trong.&lt;br&gt;
&lt;font color="Purple"&gt;sDefaultText&lt;/font&gt; : văn bản mặc định hiển thị khi Editor mở ra. Đây là 1 chuỗi HTML.&lt;br&gt;
&lt;font color="Purple"&gt;iWidth&lt;/font&gt; : chiều rộng của khung soạn thảo.&lt;br&gt;
&lt;font color="Purple"&gt;iHeight&lt;/font&gt; : chiều cao của khung soạn thảo.&lt;br&gt;
&lt;br&gt;
Trong hàm dựng, chúng ta thiết kế các thuộc tính :&lt;br&gt;
&lt;br&gt;
&lt;font color="DarkRed"&gt;ID &lt;/font&gt;: định danh riêng&lt;br&gt;
&lt;font color="DarkRed"&gt;content&lt;/font&gt; : nội dung văn bản trong editor&lt;br&gt;
&lt;font color="DarkRed"&gt;width&lt;/font&gt; : chiều rộng&lt;br&gt;
&lt;font color="DarkRed"&gt;height &lt;/font&gt;: chiều cao&lt;br&gt;
&lt;font color="DarkRed"&gt;UI&lt;/font&gt; : tham chiếu đến khung iframe&lt;br&gt;
&lt;font color="DarkRed"&gt;editor&lt;/font&gt; : tham chiếu đến đối tượng document của khung iframe. Biến này trực tiếp thi hành các command.&lt;br&gt;
&lt;br&gt;
Hàm &lt;b&gt;doFormat&lt;/b&gt;  ở bản cũ sẽ trở thành phương thức &lt;b&gt;&lt;i&gt;formatText&lt;/i&gt;&lt;/b&gt; của lớp  đối tượng RichTextEditor :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 114px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;RichTextEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prototype&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;formatText&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=function(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;command&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;queryCommandEnabled&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;command&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(!&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;}&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;execCommand&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;command&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;}&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;&lt;br&gt;
Và tương tự cho &lt;b&gt;addLink&lt;/b&gt;, &lt;b&gt;insertImage&lt;/b&gt;, &lt;b&gt;unformat&lt;/b&gt; :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 290px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;RichTextEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prototype&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;addLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=function(){&lt;br&gt;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prompt&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Enter&amp;nbsp;or&amp;nbsp;paste&amp;nbsp;a&amp;nbsp;link&amp;nbsp;:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;''&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;formatText&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'CreateLink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;}&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;RichTextEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prototype&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;insertImage&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=function(){&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;UI&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;focus&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prompt&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Enter&amp;nbsp;or&amp;nbsp;paste&amp;nbsp;a&amp;nbsp;URL&amp;nbsp;:'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;''&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;formatText&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'InsertImage'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;aLink&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;}&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;RichTextEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prototype&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;unformat&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=function(){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;formatText&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'removeformat'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;formatText&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'unlink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Ngoài ra chúng ta cũng thêm vào 1 phương thức mới là &lt;b&gt;&lt;i&gt;getContent&lt;/i&gt;&lt;/b&gt; để lấy nội dung văn bản :&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 66px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;RichTextEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;prototype&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getContent&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=function(){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;editor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;body&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;innerHTML&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Cuối cùng là 1 hàm dùng để khởi tạo trình soạn thảo, được gọi sau khi trang load xuống hoàn chỉnh :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 194px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;init&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(){&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;RTE&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=new&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;RichTextEditor&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'RTE'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'wysiwyg'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;''&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;500&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;240&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'btnBold'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'RTE.formatText("bold")'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'btnItalic'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'RTE.formatText("italic")'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'btnUnderline'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'&amp;nbsp;RTE.formatText("underline");'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'btnInsertImage'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'RTE.insertImage();'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'btnAddLink'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'RTE.addLink();'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;setBtnAction&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'btnUnformat'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'&amp;nbsp;RTE.unformat();'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br&gt;}&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Biến &lt;i&gt;&lt;font color="Blue"&gt;RTE&lt;/font&gt;&lt;/i&gt; được dùng làm một thể hiện của lớp RichTextEditor. Các dòng sau thiết lập hành động cho từng nút lệnh trên toolBar.&lt;br&gt;
&lt;b&gt;&lt;br&gt;
init&lt;/b&gt; được gọi cùng sự kiện &lt;i&gt;onload&lt;/i&gt; :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;PHP Code:&lt;/div&gt;
	&lt;div class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 34px; text-align: left;"&gt;
		&lt;code style="white-space: nowrap;"&gt;
			&lt;!-- php buffer start --&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;
&lt;span style="color: rgb(0, 0, 187);"&gt;window&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;onload&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;init&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&amp;nbsp;
&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;/span&gt;
&lt;/span&gt;
&lt;/code&gt;&lt;!-- php buffer end --&gt;
		&lt;/code&gt;
	&lt;/div&gt;
&lt;/div&gt;Và thế là chúng ta đã có phiên bản Rich Text Editor mới, tuy
không thay đổi trên giao diện, nhưng cấu trúc chương trình đã trở nên
chặt chẽ hơn hẳn :&lt;br&gt;
&lt;br&gt;
Demo  :&lt;br&gt;
&lt;a href="http://sacroyantlabs.googlepages.com/rte2.htm" target="_blank"&gt;http://sacroyantlabs.googlepages.com/rte2.htm&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Download code :&lt;br&gt;
&lt;a href="http://snlibs.googlepages.com/DemoEditor.zip" target="_blank"&gt;http://snlibs.googlepages.com/DemoEditor.zip&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Còn đây là sản phẩm hoàn thiện :&lt;br&gt;
&lt;br&gt;
&lt;a href="http://sacroyant.googlepages.com/r_editor.htm" target="_blank"&gt;&lt;img src="http://farm3.static.flickr.com/2415/2151215572_d8a243314e_m.jpg" alt="" onload="NcodeImageResizer.createOn(this);" border="0"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Từ bản demo rút gọn đến sản phẩm sau cùng chỉ còn một quãng đường ngắn,
và chắc hẳn bạn sẽ cảm thấy dễ chịu hơn nếu đi tới đó một mình&lt;br&gt;&lt;br&gt;Clipboard  là một vùng nhớ tạm trong window, nơi chứa dữ liệu mà chúng ta đã &lt;i&gt;copy&lt;/i&gt; hay &lt;i&gt;cut&lt;/i&gt;.
Các ứng dụng khác nhau vẫn được phép sử dụng chung khối dữ liệu này. Có
nghĩa là có thể bạn copy text trong MS Word, sau đó dán lên khung soạn
thảo của &lt;a href="http://docs.google.com/" target="_blank"&gt;Google Docs&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Các command "&lt;i&gt;&lt;font color="Sienna"&gt;copy&lt;/font&gt;&lt;/i&gt;", "&lt;i&gt;&lt;font color="Sienna"&gt;cut&lt;/font&gt;&lt;/i&gt;", "&lt;font color="Sienna"&gt;&lt;i&gt;paste&lt;/i&gt;&lt;/font&gt;"
cho phép RTE của chúng ta làm điều này. Nhưng vì lý do an toàn, ngoại
trừ IE, các trình duyệt khác đều mặc định vô hiệu hóa tính năng trên.&lt;br&gt;
&lt;br&gt;
Nếu Java Script cố gọi thử lệnh này trên Mozilla, trình duyệt sẽ trả về lỗi :&lt;br&gt;
&lt;br&gt;
&lt;div style="margin: 5px 20px 20px;"&gt;
	&lt;div class="smallfont" style="margin-bottom: 2px;"&gt;Quote:&lt;/div&gt;
	&lt;table border="0" cellpadding="6" cellspacing="0" width="100%"&gt;
	&lt;tbody&gt;&lt;tr&gt;
		&lt;td class="alt2" style="border: 1px inset ;"&gt;
			
				&lt;div&gt;
					Được gửi bởi &lt;strong&gt;Mozilla Eror Console&lt;/strong&gt;
					
				&lt;/div&gt;
				&lt;div style="font-style: italic;"&gt;Error:
[Exception... "Access to XPConnect service denied" code: "1011"
nsresult: "0x805303f3 (NS_ERROR_DOM_XPCONNECT_ACCESS_DENIED)"&lt;/div&gt;
			
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;Google Docs bắt lỗi này lại và cho ra thông báo :&lt;br&gt;
&lt;br&gt;
&lt;img src="http://farm3.static.flickr.com/2111/2158772881_27c098df3f_o.jpg" alt="" onload="NcodeImageResizer.createOn(this);" border="0"&gt;&lt;br&gt;
&lt;br&gt;
Nhiều phương pháp đã được đưa ra để khắc phục trở ngại này, đồng thời
tránh khỏi việc phải yêu cầu người dùng thay đổi cấu hình trên hệ thống
của họ. Một trong những phương pháp khá thú vị là sử dụng Action
Script. Do ngôn ngữ này có thể can thiệp sâu vào hệ thống của client
nên 1 chương trình flash đã được viết ra để bổ sung khả năng vào nơi mà
Java Script bất lực. (&lt;a href="http://www.jeffothy.com/weblog/clipboard-copy/" target="_blank"&gt;Xem chi tiết&lt;/a&gt;)&lt;br&gt;
&lt;br&gt;
Nhưng nếu bạn từng sử dụng &lt;a href="http://writer.zoho.com/" target="_blank"&gt;Zoho Writer&lt;/a&gt;,
bạn sẽ thấy họ vẫn làm cho các lệnh copy, cut và paste hoạt động được
trên FireFox. Lần tìm giải pháp trong source code của một ứng dụng web
phức tạp như &lt;a href="http://writer.zoho.com/" target="_blank"&gt;Zoho Writer&lt;/a&gt; là một việc không mấy dễ dàng. Chỉ còn cách dựa trên các biểu hiện để phán đoán.&lt;br&gt;
&lt;br&gt;
Điều dễ nhận thấy là chúng ta không thể đem paste khối văn bản được
copy hay cut từ khung soạn thảo của Zoho Writer vào MS Word, và ngược
lại, cũng không thể dùng lệnh paste trên khung soạn thảo của Zoho
Writer để chèn vào nó những gì có tr