技术标签: 笔记 JavaScript js javascript
bool = document.execCommand(aCommandName, aShowDefaultUI, aValueArgument)
一个 Boolean ,如果是 false 则表示操作不被支持或未被启用。
参数 | 描述 |
---|---|
aCommandName | 一个 DOMString ,命令的名称。可用命令列表请参阅 命令 |
aShowDefaultUI | 一个 Boolean, 是否展示用户界面,一般为 false。Mozilla 没有实现 |
aValueArgument | 一些命令(例如insertImage)需要额外的参数(insertImage需要提供插入image的url),默认为null |
命令 | 描述 |
---|---|
2D-Position | 允许通过拖曳移动绝对定位的对象 |
AbsolutePosition | 设定元素的 position 属性为“absolute”(绝对) |
BackColor | 设置或获取当前选中区的背景颜色 |
Bold | 切换当前选中区的粗体显示与否 |
Copy | 将当前选中区复制到剪贴板 |
CreateBookmark | 创建一个书签锚或获取当前选中区或插入点的书签锚的名称 |
CreateLink | 在当前选中区上插入超级链接,或显示一个对话框允许用户指定要为当前选中区插入的超级链接的 URL |
Cut | 将当前选中区复制到剪贴板并删除之 |
Delete | 删除当前选中区 |
FontName | 设置或获取当前选中区的字体 |
FontSize | 设置或获取当前选中区的字体大小 |
ForeColor | 设置或获取当前选中区的前景(文本)颜色 |
FormatBlock | 设置当前块格式化标签 |
Indent | 增加选中文本的缩进 |
InsertButton | 用按钮控件覆盖当前选中区 |
InsertFieldset | 用方框覆盖当前选中区 |
InsertHorizontalRule | 用水平线覆盖当前选中区 |
InsertIFrame | 用内嵌框架覆盖当前选中区 |
InsertImage | 用图像覆盖当前选中区 |
InsertInputButton | 用按钮控件覆盖当前选中区 |
InsertInputCheckbox | 用复选框控件覆盖当前选中区 |
InsertInputFileUpload | 用文件上载控件覆盖当前选中区 |
InsertInputHidden | 插入隐藏控件覆盖当前选中区 |
InsertInputImage | 用图像控件覆盖当前选中区 |
InsertInputPassword | 用密码控件覆盖当前选中区 |
InsertInputRadio | 用单选钮控件覆盖当前选中区 |
InsertInputReset | 用重置控件覆盖当前选中区 |
InsertInputSubmit | 用提交控件覆盖当前选中区 |
InsertInputText | 用文本控件覆盖当前选中区 |
InsertMarquee | 用空字幕覆盖当前选中区 |
InsertOrderedList | 切换当前选中区是编号列表还是常规格式化块 |
InsertParagraph | 用换行覆盖当前选中区 |
InsertSelectDropdown | 用下拉框控件覆盖当前选中区 |
InsertSelectListbox | 用列表框控件覆盖当前选中区 |
InsertTextArea | 用多行文本输入控件覆盖当前选中区 |
InsertUnorderedList | 切换当前选中区是项目符号列表还是常规格式化块 |
Italic | 切换当前选中区斜体显示与否 |
JustifyCenter | 将当前选中区在所在格式化块置中 |
JustifyLeft | 将当前选中区所在格式化块左对齐 |
JustifyRight | 将当前选中区所在格式化块右对齐 |
LiveResize | 迫使 MSHTML 编辑器在缩放或移动过程中持续更新元素外观,而不是只在移动或缩放完成后更新 |
MultipleSelection | 允许当用户按住 Shift 或 Ctrl 键时一次选中多于一个站点可选元素 |
Outdent | 减少选中区所在格式化块的缩进 |
OverWrite | 切换文本状态的插入和覆盖 |
Paste | 用剪贴板内容覆盖当前选中区 |
打开打印对话框以便用户可以打印当前页 | |
Refresh | 刷新当前文档 |
RemoveFormat | 从当前选中区中删除格式化标签 |
SaveAs | 将当前 Web 页面保存为文件 |
SelectAll | 选中整个文档 |
UnBookmark | 从当前选中区中删除全部书签 |
Underline | 切换当前选中区的下划线显示与否 |
Unlink | 从当前选中区中删除全部超级链接 |
Unselect | 清除当前选中区的选中状态 |
<!DOCTYPE html>
<html>
<head>
<title>JavaScript--execCommand指令集</title>
<script>
<!--
/*
*该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>
<input id="edit" value="范例" NAME="edit"><br>
<button onclick="fn_doufucopy()" ID="Button1">Copy</button> <button onclick="fn_doufupaste()" ID="Button2">paste</button><br>
<textarea id="tt" rows="10" cols="50" NAME="tt"></textarea>
<hr>
<br>
浮沉聚散变化又再,但是总可卷土重来.<br>
天若有情天亦老,人间正道是沧桑.<br>
都怪我,太执着,却也等不到花开叶落.<br>
<br>
Please select above letters, then click following buttons:<br>
<hr>
<input type="button" value="创建CreateLink" onclick="fn_creatlink()" ID="Button3" NAME="Button3"><br>
<input type="button" value="改变文字背景色" onclick="fn_change_backcolor()" ID="Button4" NAME="Button4"><br>
<input type="button" value="改变文字前景色" onclick="fn_change_forecolor()" ID="Button5" NAME="Button5"><br>
<input type="button" value="给文字加线条" onclick="fn_change_selection()" ID="Button6" NAME="Button6"><br>
<input type="button" value="改变文字的排列" onclick="fn_format()" ID="Button7" NAME="Button7"><br>
<input type="button" value="删除或剪下选中的部分" onclick="fn_CutOrDel()" ID="Button8" NAME="Button8"><br>
<input type="button" value="插入Object" onclick="fn_InsObj()" ID="Button9" NAME="Button9"><br>
<input type="button" value="保存或打印文件" onclick="fn_save()" ID="Button10" NAME="Button10"><br>
<input type="button" value="测试Refresh属性" onclick="document.execCommand('Refresh')" ID="Button11"
NAME="Button11">
</body>
</html>
BinTree Insert( BinTree BST, ElementType X ){ if(!BST){ BST=(BinTree)malloc(sizeof(BinTree)); BST->Data=X; BST->Left=BST->Right=NULL; } else { if(XData) BST->Left=Insert(BST->Left,X);
1.打嗝的时候,舌头下面含白糖!打嗝的时候 捏着鼻子喝水 就好了,打嗝的时候用大拇指用力掐中指指腹。就不会了 2.每天用红红的上海药皂洗脚,洗袜子鞋垫神秘的,可以去脚臭。 3.芒果在煤气上转几秒,那皮就很好剥了 4.番茄怕有农药,用开水烫下,皮就剥下来了 5.说个地球人都知道的,如果衣物上不小心滴上了油,在洗衣服之前,保持衣服是干的,然后在滴油的地方滴上洗洁精,再搓两下,洗...
Java 解析Pcap文件(2)@author:[email protected]:2021.03.11前面介绍了Pcap文件的结构并对Pcap文件的 Global Header 和 Packet Header进行了解析,接下来就是对Packet Data 即数据链路层的帧进行解析了。数据链路层解析Pcap包的Packet Data就是数据链路层的帧,可以根据前面的Packet Header 中的 capLen 字段知道对应的Packet Data 数据的字节数,从而进行读取。这里仅仅以以太网的帧为例进
转自西瓜书《机器学习》上节我们介绍了支持向量机的基本型及其推导过程,这节我们对基本型求解。上节我们推导的模型为我们希望求解上式来得到大间隔划分超平面所对应的模型其中w,b是模型参数,注意到式(1)本身是一个凸二次规划问题。能直接用现成的优化计算包求解,但我们可以有更高效的方法。简单介绍一下凸二次规划,转自博客二次规划(quadratic programming)二次规划是指,带有二次型目标函数和约...
一、DVS (Digital Video Server)网络视频服务器的简称。DVS(网络视频服务器)的原理 网络视频服务器主要实现模拟视音频信号的IP化。经数字化的视音频信号MPEG-4 视频压缩算法和G.729/ADPCM 音频压缩算法进行压缩编码,然后通过IP网将低码率的视音频编码数据以IP 包的形式传送给多个远端PC或网络视频×××,实现视音...
strcat 、strcpy、strcmp常用的字符串处理函数:1. strcat:stract是string catenate的缩写,此函数有两个字符数组参数,函数的作用是将第二个字符数组中的字符串连接到第一个字符数组的字符串后面。例如: char str01[10] ="Hello "; char str02[10] = "World"; cout << strcat(str01,str02);结果为: Hello World注意:第二个参数为字符型常数组,应为:strc
样本方差与样本标准差1、定义:样本中各数据与样本平均数的差的平方和的平均数叫做样本方差;样本方差的算术平方根叫做样本标准差。 注:样本方差和样本标准差都是衡量一个样本波动大小的量,样本方差或样本标准差越大,样本数据的波动就越大。标准差与标准方差1、定义:方差是各个数据与平均数之差的平方和的平均数。在概率论和数理统计中,方差用来度量随机变量和其数学期望(即均值)...
(问题解决)(自制脚本)Ubuntu20.04 键盘会突然失灵、键盘延迟突然很大怎么办
时间:2020年10月30日地点:上海中庚聚龙酒店场次:数据库&数据资产管理专场演讲主题:《字节跳动数据治理实践》你将收获:大而泛的数据治理概念如何变成可落地的建设框架?数据治理...
看不懂数位DP,蒟蒻就是蒟蒻:http://fancypei.github.io/2016/04/16/SDOI2016%20Round1/然后ZZY Google到了一个神奇的做法,很happy:https://blog.menci.moe/sdoi2016-table/强力膜拜考虑异或的性质:性质一:对于任意 x性质二:对于任意 x≠yx≠y,必
使用快捷键查找错误和警告如下图所示 我们可以用F2/Shift+F2来快速定位错误和警告,这在几百行代码中定位错误是非常方便的。切换模式如下图所示,右键点击编辑区右上角的位置,可以在Go the high priority problems only 和 Go to next problem模式间切换Go the high priority problems only 在优先...