document.execCommand()的用法小結(jié)
首先要說明的是在firefox下支持不好。
2D-Position 允許通過拖曳移動絕對定位的對象。
AbsolutePosition 設(shè)定元素的 position 屬性為“absolute”(絕對)。
BackColor 設(shè)置或獲取當(dāng)前選中區(qū)的背景顏色。
BlockDirLTR 目前尚未支持。
BlockDirRTL 目前尚未支持。
Bold 切換當(dāng)前選中區(qū)的粗體顯示與否。
BrowseMode 目前尚未支持。
Copy 將當(dāng)前選中區(qū)復(fù)制到剪貼板。
CreateBookmark 創(chuàng)建一個(gè)書簽錨或獲取當(dāng)前選中區(qū)或插入點(diǎn)的書簽錨的名稱。
CreateLink 在當(dāng)前選中區(qū)上插入超級鏈接,或顯示一個(gè)對話框允許用戶指定要為當(dāng)前選中區(qū)插入的超級鏈接的 URL。
Cut 將當(dāng)前選中區(qū)復(fù)制到剪貼板并刪除之。
Delete 刪除當(dāng)前選中區(qū)。
DirLTR 目前尚未支持。
DirRTL 目前尚未支持。
EditMode 目前尚未支持。
FontName 設(shè)置或獲取當(dāng)前選中區(qū)的字體。
FontSize 設(shè)置或獲取當(dāng)前選中區(qū)的字體大小。
ForeColor 設(shè)置或獲取當(dāng)前選中區(qū)的前景(文本)顏色。
FormatBlock 設(shè)置當(dāng)前塊格式化標(biāo)簽。
Indent 增加選中文本的縮進(jìn)。
InlineDirLTR 目前尚未支持。
InlineDirRTL 目前尚未支持。
InsertButton 用按鈕控件覆蓋當(dāng)前選中區(qū)。
InsertFieldset 用方框覆蓋當(dāng)前選中區(qū)。
InsertHorizontalRule 用水平線覆蓋當(dāng)前選中區(qū)。
InsertIFrame 用內(nèi)嵌框架覆蓋當(dāng)前選中區(qū)。
InsertImage 用圖像覆蓋當(dāng)前選中區(qū)。
InsertInputButton 用按鈕控件覆蓋當(dāng)前選中區(qū)。
InsertInputCheckbox 用復(fù)選框控件覆蓋當(dāng)前選中區(qū)。
InsertInputFileUpload 用文件上載控件覆蓋當(dāng)前選中區(qū)。
InsertInputHidden 插入隱藏控件覆蓋當(dāng)前選中區(qū)。
InsertInputImage 用圖像控件覆蓋當(dāng)前選中區(qū)。
InsertInputPassword 用密碼控件覆蓋當(dāng)前選中區(qū)。
InsertInputRadio 用單選鈕控件覆蓋當(dāng)前選中區(qū)。
InsertInputReset 用重置控件覆蓋當(dāng)前選中區(qū)。
InsertInputSubmit 用提交控件覆蓋當(dāng)前選中區(qū)。
InsertInputText 用文本控件覆蓋當(dāng)前選中區(qū)。
InsertMarquee 用空字幕覆蓋當(dāng)前選中區(qū)。
InsertOrderedList 切換當(dāng)前選中區(qū)是編號列表還是常規(guī)格式化塊。
InsertParagraph 用換行覆蓋當(dāng)前選中區(qū)。
InsertSelectDropdown 用下拉框控件覆蓋當(dāng)前選中區(qū)。
InsertSelectListbox 用列表框控件覆蓋當(dāng)前選中區(qū)。
InsertTextArea 用多行文本輸入控件覆蓋當(dāng)前選中區(qū)。
InsertUnorderedList 切換當(dāng)前選中區(qū)是項(xiàng)目符號列表還是常規(guī)格式化塊。
Italic 切換當(dāng)前選中區(qū)斜體顯示與否。
JustifyCenter 將當(dāng)前選中區(qū)在所在格式化塊置中。
JustifyFull 目前尚未支持。
JustifyLeft 將當(dāng)前選中區(qū)所在格式化塊左對齊。
JustifyNone 目前尚未支持。
JustifyRight 將當(dāng)前選中區(qū)所在格式化塊右對齊。
LiveResize 迫使 MSHTML 編輯器在縮放或移動過程中持續(xù)更新元素外觀,而不是只在移動或縮放完成后更新。
MultipleSelection 允許當(dāng)用戶按住 Shift 或 Ctrl 鍵時(shí)一次選中多于一個(gè)站點(diǎn)可選元素。
Open 打開。
Outdent 減少選中區(qū)所在格式化塊的縮進(jìn)。
OverWrite 切換文本狀態(tài)的插入和覆蓋。
Paste 用剪貼板內(nèi)容覆蓋當(dāng)前選中區(qū)。
PlayImage 目前尚未支持。
Print 打開打印對話框以便用戶可以打印當(dāng)前頁。
Redo 重做。
Refresh 刷新當(dāng)前文檔。
RemoveFormat 從當(dāng)前選中區(qū)中刪除格式化標(biāo)簽。
RemoveParaFormat 目前尚未支持。
SaveAs 將當(dāng)前 Web 頁面保存為文件。
SelectAll 選中整個(gè)文檔。
SizeToControl 目前尚未支持。
SizeToControlHeight 目前尚未支持。
SizeToControlWidth 目前尚未支持。
Stop 停止。
StopImage 目前尚未支持。
StrikeThrough 目前尚未支持。
Subscript 目前尚未支持。
Superscript 目前尚未支持。
UnBookmark 從當(dāng)前選中區(qū)中刪除全部書簽。
Underline 切換當(dāng)前選中區(qū)的下劃線顯示與否。
Undo 撤消。
Unlink 從當(dāng)前選中區(qū)中刪除全部超級鏈接。
Unselect 清除當(dāng)前選中區(qū)的選中狀態(tài)。
例1:
isNaN是測試是否為數(shù)值型 ,限制輸入只能為數(shù)值如:1981.121,允許最多有一個(gè)小數(shù)點(diǎn)
<input type="text" name="text" onkeyup="if(isNaN(value))execCommand('undo')" />
例2:
<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)>
相關(guān)文章
JavaScript中Form表單技術(shù)匯總(推薦)
這篇文章主要介紹了JavaScript中Form表單技術(shù)的相關(guān)資料,包括簡單的表單驗(yàn)證和正則表達(dá)式驗(yàn)證,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-06-06
JS實(shí)現(xiàn)網(wǎng)頁每隔3秒彈出一次對話框的方法
這篇文章主要介紹了JS實(shí)現(xiàn)網(wǎng)頁每隔3秒彈出一次對話框的方法,涉及JavaScript結(jié)合時(shí)間函數(shù)遞歸調(diào)用的相關(guān)技巧,非常簡單,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11
uniapp自定義驗(yàn)證碼輸入框并隱藏光標(biāo)
這篇文章主要介紹了uniapp自定義驗(yàn)證碼輸入框隱藏光標(biāo),效果是點(diǎn)擊輸入框喚起鍵盤,藍(lán)框就相當(dāng)于input的光標(biāo),驗(yàn)證碼輸入錯(cuò)誤或者不符合格式要求會將字體以及邊框改成紅色提示持續(xù)1s然后清空數(shù)據(jù),恢復(fù)原邊框樣式,需要的朋友可以參考下2023-02-02
輕松實(shí)現(xiàn)jquery手風(fēng)琴效果
這篇文章主要為大家介紹了實(shí)現(xiàn)jquery手風(fēng)琴效果的詳細(xì)代碼,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-01-01
微信小程序如何保證每個(gè)頁面都已經(jīng)登陸詳解
前段時(shí)間發(fā)布了一個(gè)微信小程序的簡單登錄,但遇到一個(gè)問題,怎么確保用戶每個(gè)頁面都已經(jīng)登陸了呢,這篇文章主要給大家介紹了關(guān)于微信小程序如何保證每個(gè)頁面都已經(jīng)登陸的相關(guān)資料,需要的朋友可以參考下2021-11-11

