document.execCommmand()関数利用可能パラメータ
7524 ワード
<HTML>
<HEAD>
<TITLE>JavaScript--execCommand </TITLE>
<SCRIPTLANGUAGE="javascript">
<!--
/*
* function copy
*/
function fn_doufucopy(){
edit.select();
document.execCommand('Copy');
}
/*
* function paste
*/
function fn_doufupaste() {
tt.focus();
document.execCommand('paste');
}
/*
* function
*/
function fn_creatlink()
{
document.execCommand('CreateLink',true,'true');// URL
//document.execCommand('CreateLink',false,'http://www.51js.com');
}
/*
* function
*/
function fn_change_backcolor()
{
document.execCommand('BackColor',true,'#FFbbDD');//true false
}
/*
* function , , ,
*/
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
*/
function fn_change_selection()
{
//
document.execCommand('Underline');
//
document.execCommand('StrikeThrough');
//
document.execCommand('SuperScript');
//
document.execCommand('Underline');
}
/*
* function
*/
function fn_format()
{
//
document.execCommand('InsertOrderedList');
//
document.execCommand('InsertUnorderedList');
//
document.execCommand('Indent');
}
/*
* function
*/
function fn_CutOrDel()
{
//
//document.execCommand('Delete');
//
document.execCommand('Cut');
}
/*
* function
*/
function fn_InsObj()
{
/*
******************************************
* object;
* , true false ;
* object id;
* javascript id
******************************************
*/
/* button(InsertButton InsertInputButtong ,
button, input)*/
/*document.execCommand('InsertButton',false,"aa"); //true false
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 ,false
//document.execCommand('InsertImage',false,"aa");
// checkbox
//document.execCommand('InsertInputCheckbox',true,"aa");
// file object
//document.execCommand('InsertInputFileUpload',false,"aa");
// hidden
/*document.execCommand('InsertInputHidden',false,"aa");
alert(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");
// 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('InsertMarquee',true,"aa");
document.all.aa.innerText="bbbbb";*/
//
//document.execCommand('Unselect');
//
//document.execCommand('SelectAll');
}
/*
* function
*/
function fn_save()
{
//
document.execCommand('SaveAs','mycodes.txt');
//
//document.execCommand('print');
}
-->
</SCRIPT>
</HEAD>
<body>
<inputid="edit"value=" "NAME="edit"><br>
<buttononclick="fn_doufucopy()"ID="Button1">Copy</button> <buttononclick="fn_doufupaste()"ID="Button2">
paste</button><br>
<textareaid="tt"rows="10"cols="50"NAME="tt"></textarea>
<hr>
<br>
, .<br>
, .<br>
, , .<br>
<br>
Please select above letters, then click following buttons:<br>
<hr>
<inputtype="button"value=" CreateLink"onclick="fn_creatlink()"ID="Button3"NAME="Button3"><br>
<inputtype="button"value=" "onclick="fn_change_backcolor()"ID="Button4"NAME="Button4"><br>
<inputtype="button"value=" "onclick="fn_change_forecolor()"ID="Button5"NAME="Button5"><br>
<inputtype="button"value=" "onclick="fn_change_selection()"ID="Button6"NAME="Button6"><br>
<inputtype="button"value=" "onclick="fn_format()"ID="Button7"NAME="Button7"><br>
<inputtype="button"value=" "onclick="fn_CutOrDel()"ID="Button8"NAME="Button8"><br>
<inputtype="button"value=" Object"onclick="fn_InsObj()"ID="Button9"NAME="Button9"><br>
<inputtype="button"value=" "onclick="fn_save()"ID="Button10"NAME="Button10"><br>
<inputtype="button"value=" Refresh "onclick="document.execCommand('Refresh')"ID="Button11"
NAME="Button11">
</body>
</HTML>