<HTML>
<หัว>
<TITLE>javaScript--execCommand คำสั่ง</TITLE>
<ภาษาสคริปต์="จาวาสคริปต์">
-
* 该ฟังก์ชั่น执行copy指令
-
document.execCommand("BackgroundImageCache", เท็จ, จริง);
ฟังก์ชั่น fn_doufucopy(){
แก้ไข.เลือก();
document.execCommand('คัดลอก');
-
-
* 该ฟังก์ชัน执行paste指令
-
ฟังก์ชั่น fn_doufupaste(){
tt.โฟกัส();
document.execCommand('วาง');
-
-
* 该ฟังก์ชั่น用来创建一个超链接
-
ฟังก์ชั่น fn_creatlink() {
document.execCommand('CreateLink',true,'true');//弹出一个对话框输入URL
//document.execCommand('CreateLink',false,'http://www.51cto.com');
-
-
* 该ฟังก์ชั่น用来将选中的区块设为指定的背景色
-
ฟังก์ชั่น 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); //จริง或เท็จ都可以
// 字体必须是系统支持的字体
document.execCommand('FontName',false,'标楷体'); //จริง或เท็จ都可以
//字体变粗
document.execCommand('ตัวหนา');
//变斜体
document.execCommand('ตัวเอียง');
-
http://www.devdao.com/
-
* 该function用来将选中的区块加上不同的线条
-
ฟังก์ชั่น fn_change_selection(){
//将选中的文字加下划线
document.execCommand('ขีดเส้นใต้');
//在选中的文字上划粗线
document.execCommand('ขีดทับ');
//将选中的部分文字变细
document.execCommand('ซุปเปอร์สคริปต์');
//将选中区块的下划线取消掉
document.execCommand('ขีดเส้นใต้');
-
-
* 该ฟังก์ชั่น用来将选中的区块排成不同的格式
-
ฟังก์ชั่น fn_format(){
//มี序列排列
document.execCommand('InsertOrderedList');
//实heart无序列排列
document.execCommand('InsertUnorderedList');
//空heart无序列排列
document.execCommand('เยื้อง');
-
-
* 该ฟังก์ชั่น用来将选中的区块剪下或是删除掉
-
ฟังก์ชั่น fn_CutOrDel(){
//删除选中的区块
//document.execCommand('ลบ');
//剪下选中的区块
document.execCommand('ตัด');
-
-
* 该function用来将选中的区块重设为一个相应的物件
-
ฟังก์ชั่น fn_InsObj(){
-
-
* 以下指令都是为选中的区块重设一个วัตถุ;
* 如没有特殊说明,第二个参数true或false是一样的;
* 参数三表示为该 object 的id;
* 可以用在javascript中通过其指定的id来控制它
-
-
/*重设为一个button(InsertButton和InsertInputButtong一样, 只不前者是button,后者是input)*/
-
document.execCommand('InsertButton',false,"aa"); //จริง或เท็จ无效
document.all.aa.value="风舞九天";
-
//重设为一个fieldset
-
document.execCommand('InsertFieldSet',true,"aa");
document.all.aa.innerText="刀剑如梦";
-
//插入一个水平线
//document.execCommand('InsertHorizontalRule',true,"aa");
//插入一个iframe
//document.execCommand('InsertIFrame',true,"aa");
//插入一个InsertImage,设为true时需要image,false时不需设不需image
//document.execCommand('InsertImage',false,"aa");
// 插入一个 ช่องทำเครื่องหมาย
//document.execCommand('InsertInputCheckbox',true,"aa");
// 插入一个file类型的 object
//document.execCommand('InsertInputFileUpload',false,"aa");
//插入一个ซ่อนอยู่
-
document.execCommand('InsertInputHidden',false,"aa");
การแจ้งเตือน (document.all.aa.id);
-
// 插入一个InputImage
-
document.execCommand('InsertInputImage',false,"aa");
document.all.aa.src="F-a10.gif";*/
//插入一个PassWord
//document.execCommand('InsertInputPassword',true,"aa");
//插入一个Radio
//document.execCommand('InsertInputRadio',false,"aa");
// 插入一个รีเซ็ต
//document.execCommand('InsertInputReset',true,"aa");
//插入一个ส่ง
//document.execCommand('InsertInputSubmit',false,"aa");
//插入一个ป้อนข้อความ
//document.execCommand('InsertInputText',false,"aa");
//插入一个พื้นที่ข้อความ
//document.execCommand('InsertTextArea',true,"aa");
//插入一个 เลือกกล่องรายการ
//document.execCommand('InsertSelectListbox',false,"aa");
//插入一个เลือกครั้งเดียว
document.execCommand('InsertSelectDropdown',true,"aa");
//插入一个line break(硬回车??)
//document.execCommand('InsertParagraph');
//插入一个กระโจม
/*document.execCommand('InsertMarquee',true,"aa");
document.all.aa.innerText="bbbbb";*/
//用于取消选中的阴影部分
//document.execCommand('ยกเลิกการเลือก');
//选中页的上的所有元素
//document.execCommand('เลือกทั้งหมด');
-
-
*该function用来将页เลดี้保存为一个文件
-
ฟังก์ชั่น fn_save(){
//第二个参数为欲保存的文件名
document.execCommand('SaveAs','mycodes.txt');
//打印整个页เลดี้
//document.execCommand('PRint');
-
</สคริปต์>
</HEAD>
<ร่างกาย>
<input id="edit" value="范例" NAME="edit"><br>
<button ID="Button1">คัดลอก</button> <button ID="Button2">
วาง</ปุ่ม><br>
<textarea id="tt" rows="10" cols="50" NAME="tt"></textarea>
<ชม.>
<br>
浮沉聚散变化又再,但是总可卷土重来.<br>
天若有情天亦老,人间正道是沧桑.<br>
都怪我,太执着,却也等不到文文叶落.<br>
<br>
โปรดเลือกตัวอักษรด้านบน จากนั้นคลิกปุ่มต่อไปนี้:<br>
<ชม.>
<input type="button" value="创建CreateLink" ID="Button3" NAME="Button3"><br>
<input type="button" value="改变文字背景色" ID="Button4" NAME="Button4"><br>
<input type="button" value="改变文字前景色" ID="Button5" NAME="Button5"><br>
<input type="button" value="给文字加线条" ID="Button6" NAME="Button6"><br>
<input type="button" value="改变文字的排列" ID="Button7" NAME="Button7"><br>
<input type="button" value="删除或剪下选中的部分" ID="Button8" NAME="Button8"><br>
<input type="button" value="插入Object" ID="Button9" NAME="Button9"><br>
<input type="button" value="保存或打印文件" ID="Button10" NAME="Button10"><br>
<input type="button" value="รีเฟรช属性" onclick="document.execCommand('Refresh')" ID="Button11" NAME="Button11">
</ร่างกาย>
</HTML>
-