document.execCommand()編程

來源:互聯網
上載者:User

下面這些都是對選中內容的操作:

<input type=button value=剪下 onclick=document.execCommand('Cut')>
<input type=button value=拷貝 onclick=document.execCommand('Copy')>
<input type=button value=粘貼 onclick=document.execCommand('Paste')>
<input type=button value=撤消 onclick=document.execCommand('Undo')>
<input type=button value=重做 onclick=document.execCommand('Redo') id=button2 name=button2>
<input>
<input type=button value=刪除 onclick=document.execCommand('Delete')>
<input type=button value=黑體 onclick=document.execCommand('Bold')>
<input type=button value=斜體 onclick=document.execCommand('Italic')>
<input type=button value=底線 onclick=document.execCommand('Underline')>
<input type=button value=停止 onclick=document.execCommand('stop')>
<input type=button value=儲存 onclick=document.execCommand('SaveAs')>
<input type=button value=另存新檔 onclick=document.execCommand('Saveas',false,'c:\\test.htm')>
<input type=button value=字型 onclick=document.execCommand('FontName',false,fn)>
<input type=button value=字型大小 onclick=document.execCommand('FontSize',false,fs)>
<input type=button value=重新整理 onclick=document.execCommand('refresh',false,0)>  

UnBookmark 從當前選中區中刪除全部書籤。 
Underline 切換當前選中區的底線顯示與否。 
Undo 撤消。 
Unlink 從當前選中區中刪除全部超級連結。 
Unselect 清除當前選中區的選中狀態。

SelectAll 選中整個文檔。 

JustifyCenter 將當前選中區在所在格式化塊置中。 
JustifyLeft 將當前選中區所在格式化塊靠左對齊。 
JustifyRight 將當前選中區所在格式化塊靠右對齊。

轉自:http://blog.sina.com.cn/s/blog_4efce4d10100cimp.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

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

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