首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏SpiritLing

    JavaScript中的execCommand

    execCommand方法是执行一个对当前文档,当前选择或者给出范围的命令。 execCommand指令集</TITLE> 6 7 <SCRIPT LANGUAGE="javascript"> 8 9 <! 120 121 document.execCommand('SuperScript'); 122 123 //将选中区块的下划线取消掉 124 125 document.execCommand( //document.execCommand('InsertTextArea',true,"aa"); 268 269 //插入一个 select list box 270 271 //document.execCommand 278 279 //document.execCommand('InsertParagraph'); 280 281 //插入一个marquee 282 283 /*document.execCommand

    1.7K30发布于 2018-04-16
  • 来自专栏全栈程序员必看

    exec_command 详解_linux exec命令

    (“fontname”,””,字体) 字号–字号大小 execCommand(“fontsize”,””,字号) 加重 execCommand(“Bold”) 斜体 execCommand( ”) 下标 execCommand(“SubScript”) 有序排列–数字序号 execCommand(“InsertOrderedList”) 无序排列–圆点序号 execCommand (“InsertUnorderedList”) 向前缩进 execCommand(“Outdent”) 向后缩进 execCommand(“Indent”) 居左 execCommand(“ JustifyLeft”) 居右 execCommand(“JustifyRight”) 居中 execCommand(“JustifyCenter”) 剪切 execCommand(“Cut ”) 拷贝 execCommand(“Copy”) 粘贴 execCommand(“Paste”) 覆盖 execCommand(“Overwrite”) 取消操作–IE5.0以后可以无限取消

    3.3K30编辑于 2022-11-16
  • 来自专栏云前端

    富文本编辑器开发简介

    格式段落 居中   document.execCommand('justifyCenter'); 左对齐    document.execCommand('justifyLeft'); 右对齐 document.execCommand ,sBackColor) 加粗   document.execCommand('bold'); 斜体   document.execCommand('italic'); 下划线 document.execCommand ('underline'); 编辑 复制   document.execCommand('copy'); 剪切   document.execCommand('cut'); 粘贴   document.execCommand ('paste');(经测试无效) 全选   document.execCommand('selectAll'); 删除   document.execCommand('delete'); 后删除 document.execCommand 后退一步   document.execCommand('undo'); 打印    document.execCommand('print');(对firefox无效) 插入 插入标签    document.execCommand

    5.5K20发布于 2020-06-15
  • 来自专栏前端技术分享

    原生js 复制内容到剪切板

    document.removeEventListener('copy',copy) } document.addEventListener('copy',copy) document.execCommand ("Copy"); } 过程: 1. document.execCommand("Copy") 触发复制监听事件 2. e.clipboardData.setData 将内容添加到剪切板 3. dom); selection.removeAllRanges(); selection.addRange(range); let bool = document.execCommand ("copy", "false", null); if (bool) { alert("复制成功"); } document.execCommand( ("Copy") 触发复制事件 5. document.execCommand("unselect", "false", null) 取消选取区域 应用场景: 复制指定节点的内容

    7.9K31发布于 2020-08-24
  • 来自专栏采云轩

    前端富文本基础及实现

    document 提供了 execCommand() 方法,该方法会影响使用 designMode 或 contentEditable 属性实现可编辑区域的元素。 ('StyleWithCSS', true, true) document.execCommand('Bold', false, val) } // 斜体 const italic = (val) => { document.execCommand('StyleWithCSS', true, true) document.execCommand('italic', => { document.execCommand('StyleWithCSS', true, true) document.execCommand('italic', false, val "editor"].document.execCommand('StyleWithCSS', true, true) frames["editor"].document.execCommand(

    5.9K50编辑于 2022-12-01
  • 来自专栏前端自习课

    【富文本】268- 富文本原理了解一下?

    具体语法如下: // document.execCommand(命令名称,是否展示用户界面,命令需要的额外参数) document.execCommand(aCommandName, aShowDefaultUI : // 加粗 document.execCommand('bold', false, null); // 添加图片 document.execCommand('insertImage', false, </template> <script> export default { name: 'XrEditor', methods: { execCommand() { document.execCommand 当然了,我们开篇也说了我们的一切命令都是基于 document.execCommand 的,所以我们先小小改写一下上面代码中的 execCommand 方法,就像下面这样: <template> ')">无序列表</button> <button @click="<em>execCommand</em>('insertHorizontalRule')">水平线</button> <button @click="<em>execCommand</em>

    2.5K40发布于 2019-07-25
  • 来自专栏用户画像

    jsp button onclick事件汇总

    ('Cut')" type="button" value="剪切"> <input onClick="document.<em>execCommand</em>('Copy')" type="button" value= "拷贝"> <input onClick="document.<em>execCommand</em>('Paste')" type="button" value="粘贴"> <input onClick="document.<em>execCommand</em> ="删除"> <input onClick="document.<em>execCommand</em>('Bold')" type="button" value="黑体"> <input onClick="document.<em>execCommand</em> ('Italic')" type="button" value="斜体"> <input onClick="document.<em>execCommand</em>('Underline')" type="button ="document.execCommand('SaveAs')" type="button" value="保存"> <input onClick="document.<em>execCommand</em>('Saveas

    2.9K20发布于 2018-08-27
  • 来自专栏CSDN博客专家-小蓝枣的博客

    JavaScript 技术篇-chrome浏览器读取剪切板命令document.execCommand(‘paste‘)返回false原因及解决方法

    新版本 chrome 执行 document.execCommand('paste') 返回 false 因为读取剪切板涉及用户隐私安全,必须的用户允许的情况下可以进行访问,但是复制和剪切功能可以使用。

    1.5K10发布于 2020-09-24
  • 来自专栏前端自习课

    【Web技术】421- 富文本原理介绍

    具体语法如下: // document.execCommand(命令名称,是否展示用户界面,命令需要的额外参数)document.execCommand(aCommandName, aShowDefaultUI : // 加粗document.execCommand('bold', false, null);// 添加图片document.execCommand('insertImage', false, url </template><script>export default { name: 'XrEditor', methods: { execCommand() { document.execCommand 当然了,我们开篇也说了我们的一切命令都是基于 document.execCommand 的,所以我们先小小改写一下上面代码中的 execCommand 方法,就像下面这样: <template> ')">无序列表</button><button @click="<em>execCommand</em>('insertHorizontalRule')">水平线</button><button @click="<em>execCommand</em>

    1.3K20发布于 2019-11-26
  • 来自专栏前端小叙

    js 实现文本选中与复制

    方法一: selection api 配合  createRange api 配合 document.execCommand('copy', true) <! } } function copySelectionText() { var copysuccess; // var to check whether execCommand successfully executed try { copysuccess = document.execCommand("copy"); // run command '; // 选中 textarea.select(); // 复制 document.execCommand('copy', true); document.execCommand注意 : copy 命令执行方法 10px'; // 赋值 textarea.value = text; // 选中 textarea.select(); // 复制 document.execCommand

    11K30编辑于 2022-10-30
  • 来自专栏怡文菌

    自定义UEditor右键菜单

    ) { this.execCommand('cleardoc'); } } }, cmdName: "interlacetable", exec: function() { this.execCommand cmdName: "uninterlacetable", exec: function() { this.execCommand cmdName: "cleartablebackground", exec: function() { this.execCommand : "settablebackground", exec: function() { this.execCommand

    1.4K20编辑于 2022-12-15
  • 来自专栏前端开疆扩土之路

    前端复制方案全覆盖!验证真机与生产代码完美一致!✨

    主流复制方案 原生js API实现 document.execCommand 概述 document暴露 execCommand 方法 该方法允许运行命令来操纵可编辑内容区域的元素 我们在使用时,常常通过以一个不可见的 但是,如果需要复制的是非常大段的内容,则 execCommand() 方法可能会引起卡顿,因为 execCommand() 方法是一个同步方法,必须等复制操作结束,才能继续执行后面的代码。 该 API 被设计用来取代使用 document.execCommand() 的剪贴板访问方式。 优点 新的API,调用简单,兼容性问题少 基于Promise,不用像execCommand一样还得选中范围 看了一下兼容性也挺不错的 兼容性分析 兼容性比较低,在 can I use上查了一下 ios系统需要 重要事情说三遍 document.execCommand,clipboard.js均不支持异步数据的复制 document.execCommand,clipboard.js均不支持异步数据的复制 document.execCommand

    1.9K21编辑于 2023-10-25
  • 来自专栏腾讯IVWEB团队的专栏

    Web 一键复制与粘贴

    Clipboard 的写入 document.execCommand docment.execCommand是一个可以操作可编辑内容区域的同步方法。 // 语法 bool = document.execCommand(aCommandName, aShowDefaultUI, aValueArgument); 方法第一个参数aCommandName传入命令字 上述提到了可编辑区域, 只有input, textarea或具有contenteditable属性的元素才可以被execCommand操作 那如果不想页面中出现可编辑区域, 那可以怎么办呢? navigator.clipboardAPI 被计划用于取代document.execCommand接口, 所以也建议使用clipboardAPI 去进行复制操作。 考虑到安全原因, document.execCommand('paste')操作已经被禁止了。

    2.5K20发布于 2020-06-24
  • 来自专栏前端专栏

    JS实现复制内容到剪贴板的方法

    } copyInput.value = text; copyInput.focus(); copyInput.select(); // document.execCommand 可能会被废弃 if (document.execCommand('copy')) { document.execCommand('copy'); } copyInput.blur (); callback && callback(true); } 调用方法 copy('传入你要复制的文本'); 相关文章 navigator.clipboard document.execCommand

    3.3K20编辑于 2022-06-09
  • 来自专栏阮一峰的网络日志

    剪贴板操作 Clipboard API 教程

    Document.execCommand()方法 异步的 Clipboard API copy事件和paste事件 本文逐一介绍这三种方法。 ? 二、Document.execCommand() 方法 Document.execCommand()是操作剪贴板的传统方法,各种浏览器都支持。 它支持复制、剪切和粘贴这三个操作。 document.execCommand('copy')(复制) document.execCommand('cut')(剪切) document.execCommand('paste')(粘贴) (1 )复制操作 复制时,先选中文本,然后调用document.execCommand('copy'),选中的文本就会进入剪贴板。 ; (3)缺点 Document.execCommand()方法虽然方便,但是有一些缺点。

    3.2K10发布于 2021-01-21
  • 来自专栏码匠的流水账

    聊聊claudb的transaction command

    ).isPresent(); } } MultiCommand实现了DBCommand接口,其execute方法先判断isTxActive,非active的话才createTransaction ExecCommand claudb-1.7.1/src/main/java/com/github/tonivade/claudb/command/transaction/ExecCommand.java @Command( "exec") @TxIgnore public class ExecCommand implements DBCommand { ​ @Override public RedisToken execute TransactionState> getTransactionIfExists(Session session) { return session.removeValue("tx"); } } ExecCommand execute方法执行removeTransactionIfExists(request.getSession()) 小结 claudb transaction相关的command有MultiCommand、ExecCommand

    52311发布于 2020-08-30
  • 来自专栏前端开发随笔

    Html新特性contenteditable自定义富文本

    $refs.fileVideo.value = ""; //处理change不能同时上传相同文件 document.execCommand( "insertHTML" $refs.fileImg.value = ""; document.execCommand("InsertImage", false, res); }); }, document.execCommand 自定义富文本主要在于对document.execCommand的了解 如果还需要自定义富文本组件,比如设置字体、加粗…直接去文档地址去拿

    1.2K20发布于 2020-09-02
  • 来自专栏前端小作坊

    网页上的复制与剪切

    IE 10及以上的版本修改了Document.execCommand()方法,增加了对剪切和复制的支持。Chrome从43版本开始也支持了这项特性。 Now that we've selected the anchor text, execute the copy command var successful = document.execCommand 在document.execCommand()方法后,我们可以通过调用window.getSelection().removeAllRanges()方法来移除选中。 如果你想检查拷贝是否成功,那么你可以checkdocument.execCommand();的返回值。如果返回false那么表示不支持拷贝或者不能使用(没有选中文本)。 我们将execCommand()放到try catch里面执行是为了确保一些极端情况下浏览器会抛出错误。 剪切命令可以在文本框中使用。你可以移除文本输入框中的文字并放到剪切版中使用。

    2K20发布于 2018-08-01
  • 来自专栏海怪的编程小屋

    造一个 copy-to-clipboard 轮子

    Note: document.execCommand() only returns true if it is invoked as part of a user interaction. From Firefox 82, nested document.execCommand() calls will always return false. —— Document.execCommand ,这里要 try 一下 success = document.execCommand('copy') if (! 不过,目前还是 document.execCommand 使用的比较广泛。 虽然上面也说了 IE 对 document.execCommand 不好,但是 Clipboard API 的兼容性更差,FireFox 和 Chome 在某些版本可能都会有问题。

    1.2K30编辑于 2022-03-29
  • 来自专栏图像识别与深度学习

    《HTML5实战》Lesson10

    Week11  2016/11/23上午1-4节 一、复习 对应的html 二、execCommand实现富文本编辑控件 1、execCommand document.execCommand - Web API 接口 Javascript中document.execCommand()的用法 - 千里之外 - 博客频道 - CSDN.NET JavaScript中的execCommand 个等号与3个等号的区别 - - ITeye技术网站 3)dataset:获取以data-后面的字符串为属性名的属性值 HTML5自定义属性对象Dataset简介 « 张鑫旭-鑫空间-鑫生活 4)execCommand bool= document.execCommand(aCommandName,aShowDefaultUI,aValueArgument) 返回值 一个Boolean,如果是false则表示操作不被支持或未被启用

    87650发布于 2018-04-27
领券