今天是 2026-6-8 星期一 QQ:545684816 TEL:13979373522
首  页 | 汉字编码 | 科普知识 | 竞赛之窗 | 音乐美术 | 婺中电教  
execCommand指令集
发表时间:2009-3-22    浏览次数:795


function fn_doufucopy() {
 edit.select();
 document.execCommand('Copy');
}

function fn_doufupaste() {
 tt.focus();
 document.execCommand('Paste');
}


function fn_creatlink() {
 document.execCommand('CreateLink',true,'true');//弹出一个对话框输入URL
 //document.execCommand('CreateLink',false,'http://www.51js.com');
}

function fn_change_backcolor() {
    document.execCommand('BackColor',true,'#FFbbDD');//true或false都可以
}

function fn_change_forecolor() {
   //指定前景色
   document.execCommand('ForeColor',false,'#BBDDCC');//true或false都可以
   //指定背景色
   document.execCommand('FontSize',false,7);     //true或false都可以
   //字体必须是系统支持的字体
   document.execCommand('FontName',false,'标楷体');    //true或false都可以
   //字体变粗
   document.execCommand('Bold');
   //变斜体
   document.execCommand('Italic');
}

function fn_change_selection() {
   //将选中的文字加下划线
   document.execCommand('Underline');
   //在选中的文字上划粗线
   document.execCommand('StrikeThrough');
   //将选中的部分文字变细
   document.execCommand('SuperScript');
   //将选中区块的下划线取消掉
   document.execCommand('Underline');
}

function fn_format() {
   //有序列排列
   document.execCommand('InsertOrderedList');
   //实心无序列排列
   document.execCommand('InsertUnorderedList');
   //空心无序列排列
   document.execCommand('Indent');
}

function fn_CutOrDel() {
   //删除选中的区块
   //document.execCommand('Delete');
   //剪下选中的区块
   document.execCommand('Cut');
}

function fn_InsObj() {
 
 
 
   //重设为一个fieldset
 
   //插入一个水平线
   //document.execCommand('InsertHorizontalRule',true,"aa");
   //插入一个iframe
   //document.execCommand('InsertIFrame',true,"aa");
   //插入一个InsertImage,设为true时需要图片,false时不需图片
   //document.execCommand('InsertImage',false,"aa");
   //插入一个checkbox
   //document.execCommand('InsertInputCheckbox',true,"aa");
   //插入一个file类型的object
   //document.execCommand('InsertInputFileUpload',false,"aa");
   //插入一个hidden
 
   //插入一个InputImage
 
   //插入一个Password
   //document.execCommand('InsertInputPassword',true,"aa");
   //插入一个Radio
   //document.execCommand('InsertInputRadio',false,"aa");
   //插入一个Reset
   //document.execCommand('InsertInputReset',true,"aa");
   //插入一个Submit
   //document.execCommand('InsertInputSubmit',false,"aa");
   //插入一个input text
   //document.execCommand('InsertInputText',false,"aa");
   //插入一个textarea
   //document.execCommand('InsertTextArea',true,"aa");
   //插入一个 select list box
   //document.execCommand('InsertSelectListbox',false,"aa");
   //插入一个single select
   document.execCommand('InsertSelectDropdown',true,"aa");
   //插入一个line break(硬回车??)
   //document.execCommand('InsertParagraph');
   //插入一个marquee
 
   //用于取消选中的阴影部分
   //document.execCommand('Unselect');
   //选中页面上的所有元素
   //document.execCommand('SelectAll');
}

function fn_save() {
   //第二个参数为欲保存的文件名
   document.execCommand('SaveAs','mycodes.txt');
   //打印整个页面
   //document.execCommand('print');
}

 

Copyright© 2006-2026, All rights reserved。
地址:紫阳镇天佑西路8号 站长:汪有万 建站时间:2006-9-1