<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Code@Oxidy

    統計

    積分與排名

    BookSites

    IT NewsSite

    IT Websit

    Java WebSits

    knowledge Library

    My Blog

    SoftWare

    閱讀排行榜

    document.execCommand()函數可用參數解析

     1 <input type=button value=剪切 onclick=document.execCommand('Cut')>
     2 
     3 <input type=button value=拷貝 onclick=document.execCommand('Copy')>
     4 
     5 <input type=button value=粘貼 onclick=document.execCommand('Paste')>
     6 
     7 <input type=button value=撤消 onclick=document.execCommand('Undo')>
     8 
     9 <input type=button value=重做 onclick=document.execCommand('Redo') id=btn2 name=btn2>
    10 
    11 <input type=button value=刪除 onclick=document.execCommand('Delete')>
    12 
    13 <input type=button value=黑體 onclick=document.execCommand('Bold')>
    14 
    15 <input type=button value=斜體 onclick=document.execCommand('Italic')>
    16 
    17 <input type=button value=下劃線 onclick=document.execCommand('Underline')>
    18 
    19 <input type=button value=停止 onclick=document.execCommand('stop')>
    20 
    21 <input type=button value=保存 onclick=document.execCommand('SaveAs')>
    22 
    23 <input type=button value=另存為 onclick=document.execCommand('Saveas',false,'c:\\t.htm')>
    24 
    25 <input type=button value=字體 onclick=document.execCommand('FontName',false,fn)>
    26 
    27 <input type=button value=字體大小 onclick=document.execCommand('FontSize',false,fs)>
    28
    29 <input type=button value=刷新 onclick=document.execCommand('refresh',false,0)>

    2D-Position 允許通過拖曳移動絕對定位的對象。 
    AbsolutePosition 設定元素的 position 屬性為“absolute”(絕對)。 
    BackColor 設置或獲取當前選中區的背景顏色。 
    BlockDirLTR 目前尚未支持。 
    BlockDirRTL 目前尚未支持。 
    Bold 切換當前選中區的粗體顯示與否。 
    BrowseMode 目前尚未支持。 
    Copy 將當前選中區復制到剪貼板。 
    CreateBookmark 創建一個書簽錨或獲取當前選中區或插入點的書簽錨的名稱。 
    CreateLink 在當前選中區上插入超級鏈接,或顯示一個對話框允許用戶指定要為當前選中區插入的超級鏈接的 URL。 
    Cut 將當前選中區復制到剪貼板并刪除之。 
    Delete 刪除當前選中區。 
    DirLTR 目前尚未支持。 
    DirRTL 目前尚未支持。 
    EditMode 目前尚未支持。 
    FontName 設置或獲取當前選中區的字體。 
    FontSize 設置或獲取當前選中區的字體大小。 
    ForeColor 設置或獲取當前選中區的前景(文本)顏色。 
    FormatBlock 設置當前塊格式化標簽。 
    Indent 增加選中文本的縮進。 
    InlineDirLTR 目前尚未支持。 
    InlineDirRTL 目前尚未支持。 
    InsertButton 用按鈕控件覆蓋當前選中區。 
    InsertFieldset 用方框覆蓋當前選中區。 
    InsertHorizontalRule 用水平線覆蓋當前選中區。 
    InsertIFrame 用內嵌框架覆蓋當前選中區。 
    InsertImage 用圖像覆蓋當前選中區。 
    InsertInputButton 用按鈕控件覆蓋當前選中區。 
    InsertInputCheckbox 用復選框控件覆蓋當前選中區。 
    InsertInputFileUpload 用文件上載控件覆蓋當前選中區。 
    InsertInputHidden 插入隱藏控件覆蓋當前選中區。 
    InsertInputImage 用圖像控件覆蓋當前選中區。 
    InsertInputPassword 用密碼控件覆蓋當前選中區。 
    InsertInputRadio 用單選鈕控件覆蓋當前選中區。 
    InsertInputReset 用重置控件覆蓋當前選中區。 
    InsertInputSubmit 用提交控件覆蓋當前選中區。 
    InsertInputText 用文本控件覆蓋當前選中區。 
    InsertMarquee 用空字幕覆蓋當前選中區。 
    InsertOrderedList 切換當前選中區是編號列表還是常規格式化塊。 
    InsertParagraph 用換行覆蓋當前選中區。 
    InsertSelectDropdown 用下拉框控件覆蓋當前選中區。 
    InsertSelectListbox 用列表框控件覆蓋當前選中區。 
    InsertTextArea 用多行文本輸入控件覆蓋當前選中區。 
    InsertUnorderedList 切換當前選中區是項目符號列表還是常規格式化塊。 
    Italic 切換當前選中區斜體顯示與否。 
    JustifyCenter 將當前選中區在所在格式化塊置中。 
    JustifyFull 目前尚未支持。 
    JustifyLeft 將當前選中區所在格式化塊左對齊。 
    JustifyNone 目前尚未支持。 
    JustifyRight 將當前選中區所在格式化塊右對齊。 
    LiveResize 迫使 MSHTML 編輯器在縮放或移動過程中持續更新元素外觀,而不是只在移動或縮放完成后更新。 
    MultipleSelection 允許當用戶按住 Shift 或 Ctrl 鍵時一次選中多于一個站點可選元素。 
    Open 打開。 
    Outdent 減少選中區所在格式化塊的縮進。 
    OverWrite 切換文本狀態的插入和覆蓋。 
    Paste 用剪貼板內容覆蓋當前選中區。 
    PlayImage 目前尚未支持。 
    Print 打開打印對話框以便用戶可以打印當前頁。 
    Redo 重做。 
    Refresh 刷新當前文檔。 
    RemoveFormat 從當前選中區中刪除格式化標簽。 
    RemoveParaFormat 目前尚未支持。 
    SaveAs 將當前 Web 頁面保存為文件。 
    SelectAll 選中整個文檔。 
    SizeToControl 目前尚未支持。 
    SizeToControlHeight 目前尚未支持。 
    SizeToControlWidth 目前尚未支持。 
    Stop 停止。 
    StopImage 目前尚未支持。 
    StrikeThrough 目前尚未支持。 
    Subscript 目前尚未支持。 
    Superscript 目前尚未支持。 
    UnBookmark 從當前選中區中刪除全部書簽。 
    Underline 切換當前選中區的下劃線顯示與否。 
    Undo 撤消。 
    Unlink 從當前選中區中刪除全部超級鏈接。 
    Unselect 清除當前選中區的選中狀態。

      1 <HTML>
      2 
      3      <HEAD>
      4 
      5          <TITLE>JavaScript--execCommand指令集</TITLE>
      6 
      7          <SCRIPT LANGUAGE="javascript">
      8 
      9 <!--
     10 
     11  
     12 
     13 /*
     14 
     15 *該function執行copy指令
     16 
     17 */
     18 
     19 function fn_doufucopy(){
     20 
     21 edit.select();
     22 
     23 document.execCommand('Copy');
     24 
     25 }
     26 
     27 /*
     28 
     29 *該function執行paste指令
     30 
     31 */
     32 
     33 function fn_doufupaste() { 
     34 
     35 tt.focus();
     36 
     37 document.execCommand('paste');
     38 
     39 
     40 
     41 /*
     42 
     43 *該function用來創建一個超鏈接
     44 
     45 */
     46 
     47 function fn_creatlink()
     48 
     49 {
     50 
     51   document.execCommand('CreateLink',true,'true');//彈出一個對話框輸入URL
     52 
     53   //document.execCommand('CreateLink',false,'http://www.51js.com');
     54 
     55 }
     56 
     57 /*
     58 
     59 *該function用來將選中的區塊設為指定的背景色
     60 
     61 */
     62 
     63 function fn_change_backcolor()
     64 
     65 {
     66 
     67   document.execCommand('BackColor',true,'#FFbbDD');//true或false都可以
     68 
     69 }
     70 
     71 /*
     72 
     73 *該function用來將選中的區塊設為指定的前景色,改變選中區塊的字體大小,改變字體,字體變粗變斜
     74 
     75 */
     76 
     77 function fn_change_forecolor()
     78 
     79 {
     80 
     81 //指定前景色
     82 
     83 document.execCommand('ForeColor',false,'#BBDDCC');//true或false都可以
     84 
     85 //指定背景色
     86 
     87 document.execCommand('FontSize',false,7);   //true或false都可以
     88 
     89 //字體必須是系統支持的字體
     90 
     91 document.execCommand('FontName',false,'標楷體');   //true或false都可以
     92 
     93 //字體變粗
     94 
     95 document.execCommand('Bold');
     96 
     97 //變斜體
     98 
     99 document.execCommand('Italic');
    100 
    101 }
    102 
    103 /*
    104 
    105 *該function用來將選中的區塊加上不同的線條
    106 
    107 */
    108 
    109 function fn_change_selection()
    110 
    111 {
    112 
    113 //將選中的文字加下劃線
    114 
    115 document.execCommand('Underline');
    116 
    117 //在選中的文字上劃粗線
    118 
    119 document.execCommand('StrikeThrough');
    120 
    121 //將選中的部分文字變細
    122 
    123 document.execCommand('SuperScript');
    124 
    125 //將選中區塊的下劃線取消掉
    126 
    127 document.execCommand('Underline'); 
    128 
    129 }
    130 
    131 /*
    132 
    133   *該function用來將選中的區塊排成不同的格式
    134 
    135   */
    136 
    137 function fn_format()
    138 
    139 {
    140 
    141 //有序列排列
    142 
    143 document.execCommand('InsertOrderedList');
    144 
    145 //實心無序列排列
    146 
    147 document.execCommand('InsertUnorderedList');
    148 
    149 //空心無序列排列
    150 
    151 document.execCommand('Indent');
    152 
    153 }
    154 
    155 /*
    156 
    157 *該function用來將選中的區塊剪下或是刪除掉
    158 
    159 */
    160 
    161 function fn_CutOrDel()
    162 
    163 {
    164 
    165 //刪除選中的區塊
    166 
    167 //document.execCommand('Delete');
    168 
    169 //剪下選中的區塊
    170 
    171 document.execCommand('Cut');
    172 
    173 }
    174 
    175 /*
    176 
    177 *該function用來將選中的區塊重設為一個相應的物件
    178 
    179 */
    180 
    181 function fn_InsObj()
    182 
    183 {
    184 
    185 /*
    186 
    187   ******************************************
    188 
    189   * 以下指令都是為選中的區塊重設一個object;
    190 
    191   * 如沒有特殊說明,第二個參數true或false是一樣的;
    192 
    193   * 參數三表示為該object的id;
    194 
    195   * 可以用在javascript中通過其指定的id來控制它
    196 
    197   ******************************************
    198 
    199 */
    200 
    201 /*重設為一個button(InsertButton和InsertInputButtong一樣,
    202 
    203 只不前者是button,后者是input)*/
    204 
    205 /*document.execCommand('InsertButton',false,"aa"); //true或false無效
    206 
    207 document.all.aa.value="風舞九天";*/
    208 
    209 //重設為一個fieldset
    210 
    211 /*document.execCommand('InsertFieldSet',true,"aa");
    212 
    213 document.all.aa.innerText="刀劍如夢";*/
    214 
    215 //插入一個水平線
    216 
    217 //document.execCommand('InsertHorizontalRule',true,"aa");
    218 
    219 //插入一個iframe
    220 
    221 //document.execCommand('InsertIFrame',true,"aa");
    222 
    223 //插入一個InsertImage,設為true時需要圖片,false時不需圖片
    224 
    225 //document.execCommand('InsertImage',false,"aa");
    226 
    227 //插入一個checkbox
    228 
    229 //document.execCommand('InsertInputCheckbox',true,"aa");
    230 
    231 //插入一個file類型的object
    232 
    233 //document.execCommand('InsertInputFileUpload',false,"aa");
    234 
    235 //插入一個hidden
    236 
    237 /*document.execCommand('InsertInputHidden',false,"aa");
    238 
    239 alert(document.all.aa.id);*/
    240 
    241 //插入一個InputImage
    242 
    243 /*document.execCommand('InsertInputImage',false,"aa");
    244 
    245 document.all.aa.src="F-a10.gif";*/
    246 
    247 //插入一個Password
    248 
    249 //document.execCommand('InsertInputPassword',true,"aa");
    250 
    251 //插入一個Radio
    252 
    253 //document.execCommand('InsertInputRadio',false,"aa");
    254 
    255 //插入一個Reset
    256 
    257 //document.execCommand('InsertInputReset',true,"aa");
    258 
    259 //插入一個Submit
    260 
    261 //document.execCommand('InsertInputSubmit',false,"aa");
    262 
    263 //插入一個input text
    264 
    265 //document.execCommand('InsertInputText',false,"aa");
    266 
    267 //插入一個textarea
    268 
    269 //document.execCommand('InsertTextArea',true,"aa");
    270 
    271 //插入一個 select list box
    272 
    273 //document.execCommand('InsertSelectListbox',false,"aa");
    274 
    275 //插入一個single select
    276 
    277 document.execCommand('InsertSelectDropdown',true,"aa");
    278 
    279 //插入一個line break(硬回車??)
    280 
    281 //document.execCommand('InsertParagraph');
    282 
    283 //插入一個marquee
    284 
    285 /*document.execCommand('InsertMarquee',true,"aa");
    286 
    287 document.all.aa.innerText="bbbbb";*/
    288 
    289 //用于取消選中的陰影部分
    290 
    291 //document.execCommand('Unselect');
    292 
    293 //選中頁面上的所有元素
    294 
    295 //document.execCommand('SelectAll');
    296 
    297 }
    298 
    299 /*
    300 
    301 *該function用來將頁面保存為一個文件
    302 
    303 */
    304 
    305 function fn_save()
    306 
    307 {
    308 
    309 //第二個參數為欲保存的文件名
    310 
    311 document.execCommand('SaveAs','mycodes.txt');
    312 
    313 //打印整個頁面
    314 
    315 //document.execCommand('print');
    316 
    317 }
    318 
    319 --> 
    320 
    321          </SCRIPT>
    322 
    323      </HEAD>
    324 
    325      <body>
    326 
    327          <input id="edit" value="范例" NAME="edit"><br>
    328 
    329          <button onclick="fn_doufucopy()" ID="Button1">Copy</button> <button onclick="fn_doufupaste()" ID="Button2">
    330 
    331               paste</button><br>
    332 
    333          <textarea id="tt" rows="10" cols="50" NAME="tt"></textarea>
    334 
    335          <hr>
    336 
    337          <br>
    338 
    339          浮沉聚散變化又再,但是總可卷土重來.<br>
    340 
    341          天若有情天亦老,人間正道是滄桑.<br>
    342 
    343          都怪我,太執著,卻也等不到花開葉落.<br>
    344 
    345          <br>
    346 
    347          Please select above letters, then click following buttons:<br>
    348 
    349          <hr>
    350 
    351          <input type="button" value="創建CreateLink" onclick="fn_creatlink()" ID="Button3" NAME="Button3"><br>
    352 
    353          <input type="button" value="改變文字背景色" onclick="fn_change_backcolor()" ID="Button4" NAME="Button4"><br>
    354 
    355          <input type="button" value="改變文字前景色" onclick="fn_change_forecolor()" ID="Button5" NAME="Button5"><br>
    356 
    357          <input type="button" value="給文字加線條" onclick="fn_change_selection()" ID="Button6" NAME="Button6"><br>
    358 
    359          <input type="button" value="改變文字的排列" onclick="fn_format()" ID="Button7" NAME="Button7"><br>
    360 
    361          <input type="button" value="刪除或剪下選中的部分" onclick="fn_CutOrDel()" ID="Button8" NAME="Button8"><br>
    362 
    363          <input type="button" value="插入Object" onclick="fn_InsObj()" ID="Button9" NAME="Button9"><br>
    364 
    365          <input type="button" value="保存或打印文件" onclick="fn_save()" ID="Button10" NAME="Button10"><br>
    366 
    367          <input type="button" value="測試Refresh屬性" onclick="document.execCommand('Refresh')" ID="Button11"
    368 
    369               NAME="Button11">
    370 
    371      </body>
    372 
    373 </HTML>
    374 
    375 文章來源:http://www.cnblogs.com/Apollo/archive/2006/08/02/465520.html

      1 普通的方式是激活一個<iframe>進入編輯狀態,命令如下
      2 
      3 IframeNamer.document.designMode="On"
      4 
      5 字體--宋體、黑體、楷體等
      6 
      7 execCommand("fontname","",字體)
      8 
      9 字號--字號大小
     10 
     11 execCommand("fontsize","",字號)
     12 
     13 加重
     14 
     15 execCommand("Bold")
     16 
     17 斜體
     18 
     19 execCommand("Italic")
     20 
     21 下劃線
     22 
     23 execCommand("Underline")
     24 
     25 刪除線
     26 
     27 execCommand("StrikeThrough")
     28 
     29 上標
     30 
     31 execCommand("SuperScript")
     32 
     33 下標
     34 
     35 execCommand("SubScript")
     36 
     37 有序排列--數字序號
     38 
     39 execCommand("InsertOrderedList")
     40 
     41 無序排列--圓點序號
     42 
     43 execCommand("InsertUnorderedList")
     44 
     45 向前縮進
     46 
     47 execCommand("Outdent")
     48 
     49 向后縮進
     50 
     51 execCommand("Indent")
     52 
     53 居左
     54 
     55 execCommand("JustifyLeft")
     56 
     57 居右
     58 
     59 execCommand("JustifyRight")
     60 
     61 居中
     62 
     63 execCommand("JustifyCenter")
     64 
     65 剪切
     66 
     67 execCommand("Cut")
     68 
     69 拷貝
     70 
     71 execCommand("Copy")
     72 
     73 粘貼
     74 
     75 execCommand("Paste")
     76 
     77 覆蓋
     78 
     79 execCommand("Overwrite")
     80 
     81 取消操作--IE5.0以后可以無限取消
     82 
     83 execCommand("Undo")
     84 
     85 重復操作
     86 
     87 execCommand("Redo")
     88 
     89 設置鏈接--若按以下寫法,在IE5.0版本中會激活一個內建窗口,可以完成輸入鏈接的功能,而且還可以選擇MAILTO、FTP等各種鏈接類型,比較方便
     90 
     91 execCommand("CreateLink")
     92 
     93 在IE4.0中,沒有內建鏈接輸入窗口,所以就需要用以下方式嵌入鏈接
     94 
     95 execCommand("CreateLink","",TURL)
     96 
     97 插入圖片--由于IE中嵌入的可編控件是針對本地資源的,所以其默認的圖片資源來自本地,所以基于WEB內容的編輯最好自己做輸入框,然后用如下命令實現。
     98 
     99 execCommand("InsertImage","",ImgURL)
    100 
    101 字體顏色
    102 
    103 execCommand("ForeColor","",CColor)
    104
    文章來源:http://hi.baidu.com/lqj1112/blog/item/346a904522f8ce3c879473b9.html


    posted on 2008-07-02 10:50 oxidy 閱讀(2484) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 成人免费午夜无码视频| 日韩亚洲国产二区| 亚洲成A人片777777| 99久久精品毛片免费播放| 亚洲一区二区女搞男| 精品国产福利尤物免费| 亚洲精品无码久久久久去q| 亚洲美女aⅴ久久久91| 国产亚洲综合精品一区二区三区| 天天天欲色欲色WWW免费| 久久精品亚洲福利| 韩日电影在线播放免费版| 亚洲va久久久噜噜噜久久男同| 亚洲精品久久无码| 成人永久免费高清| 中美日韩在线网免费毛片视频 | 亚洲欧美aⅴ在线资源| 最新国产乱人伦偷精品免费网站| 国产日产亚洲系列| 成人片黄网站A毛片免费| 亚洲一区二区三区国产精品| 亚洲ts人妖网站| 叮咚影视在线观看免费完整版| 亚洲欧洲日产国码无码久久99| 国产免费一区二区视频| 国产大片91精品免费看3| 亚洲人成在线观看| 18女人水真多免费高清毛片| 亚洲区不卡顿区在线观看| 亚洲愉拍一区二区三区| 免费国产真实迷j在线观看| 国产在线国偷精品免费看| 日本不卡视频免费| 中文在线观看永久免费| 亚洲日本在线观看网址| 一区二区三区四区免费视频| 亚洲欧洲日本在线观看| 国产亚洲AV夜间福利香蕉149| 在免费jizzjizz在线播| 男女猛烈无遮掩视频免费软件| 亚洲AV无码成人精品区在线观看|