`

常用的DOCUMENT.EXECCOMMAND

阅读更多

<input type=button value=剪切 onclick=document.execCommand('Cut')>
<input type=button value=拷贝 onclick=document.execCommand('Copy')>
<input type=button value=粘贴 onclick=document.execCommand('Paste')>
<input type=button value=撤消 onclick=document.execCommand('Undo')>
<input type=button value=重做 onclick=document.execCommand('Redo') id=button2 name=button2>
<input>
<input type=button value=删除 onclick=document.execCommand('Delete')>
<input type=button value=黑体 onclick=document.execCommand('Bold')>
<input type=button value=斜体 onclick=document.execCommand('Italic')>
<input type=button value=下划线 onclick=document.execCommand('Underline')>
<input type=button value=停止 onclick=document.execCommand('stop')>
<input type=button value=保存 onclick=document.execCommand('SaveAs')>
<input type=button value=另存为 onclick=document.execCommand('Saveas',false,'c:\\test.htm')>
<input type=button value=字体 onclick=document.execCommand('FontName',false,fn)>
<input type=button value=字体大小 onclick=document.execCommand('FontSize',false,fs)>
<input type=button value=刷新 onclick=document.execCommand('refresh',false,0)>

分享到:
评论

相关推荐

    document.execCommand()的用法

    ### document.execCommand()详解 `document.execCommand()`是HTML文档对象模型(DOM)中的一个方法,用于执行浏览器的编辑命令,这些命令可以控制文本样式、布局、剪贴板操作等。此方法在早期的Web开发中被广泛使用...

    html中的内容直接下载到excel中,替换 document.execCommand(‘saveAs’)方法

    传统的做法是使用`document.execCommand('saveAs')`方法,但这个方法在某些现代浏览器中已被废弃,因此需要寻找替代方案。本篇文章将详细探讨如何在不依赖`execCommand('saveAs')`的情况下,实现HTML内容直接下载到...

    document.execCommand()解析

    《document.execCommand()解析》 在前端开发中,我们经常需要与用户进行交互,比如编辑文本、复制粘贴等操作。这些操作在浏览器环境中可以通过`document.execCommand()`方法实现。这个函数是HTML5引入的一个非常...

    javascript document.execCommand() 常用解析

    以下是一些`document.execCommand()`支持的常用命令及其作用的详细解释: - `Bold`:切换当前选中文本的粗体属性。 - `Italic`:切换当前选中文本的斜体属性。 - `Underline`:切换当前选中文本的下划线属性。 - `...

    IE图片缓存document.execCommand(&quot;BackgroundImageCache&quot;,false,true)

    为了解决这个问题,Erik发现了一个简单的方法,利用`document.execCommand`这个命令,结合特定的参数,可以强制IE6缓存背景图片。具体代码如下: ```javascript document.execCommand("BackgroundImageCache", ...

    document.execCommand()的用法小结

    `document.execCommand()` 是一个在浏览器的文档对象模型(DOM)中用于执行各种富文本编辑操作的方法。这个方法主要用于在内容可编辑区域(比如 `&lt;contenteditable&gt;` 标签或者富文本编辑器)中进行文本格式化、插入...

    【JavaScript源代码】js实现复制粘贴的两种方法.docx

    这种方法利用了`document.execCommand`API,它允许执行一系列编辑命令(如复制、剪切等)。此API已经被浏览器逐步弃用,但在某些情况下仍可使用。以下是具体实现步骤: 1. **创建一个隐藏的输入框**:用于放置待...

    类似qq空间中的留言编辑器

    case 1: E.document.execCommand("Bold");break; case 2: E.document.execCommand("Italic");break; case 3: E.document.execCommand("Underline");break; case 6: var _Text=RemoveHTML(_Text); _Text=window....

    HTML_Button[1].onclick_事件汇总

    这些操作都是通过调用 document 对象的 execCommand 方法来实现的。 4. 其他类 * window.location="view-source:" + window.location.href:查看源文件 * window.external.ShowBrowserUI('LanguageDialog', null)...

    input按钮onclick事件大全

    - **`document.execCommand('FontSize',false,fs)`**:改变选中文本的字体大小。 这些命令主要用于富文本编辑器中,使得用户能够轻松地编辑和格式化文本内容。 #### 结论 通过上述介绍可以看出,`&lt;input&gt;`按钮...

    content-edible:contentEditables 中 document.execCommand 的一个稍微甜一点的 api

    contentEditables 中 document.execCommand 的一个稍微甜一点的 api。 目标: 公开一个更容易发现的 api 以在 contentEditables 中使用。 由 DIY WYSIWYG 工具栏控制的基本功能 无依赖 ~200 行(5k-ish 未压缩) ...

    JSP调用ie菜单命令

    IE浏览器(Internet Explorer)提供了一系列的方法来支持这些功能,其中最常用的是`document.execCommand`方法。 #### 二、`document.execCommand`方法详解 `document.execCommand`是HTMLDocument接口的一个方法,...

    javascript 常用方法及技巧

    document.execCommand 窗体COOKIE document.cookie 菜单事件 document.oncontextmenu 创建元素 document.createElement("SPAN"); 根据鼠标获得元素: document.elementFromPoint(event.x,event.y).tagName==...

    IE图片缓存document.execCommand(BackgroundImageCache,false,true)

    Pixy方法受到IE的cache bug影响会闪烁。其实并没有说清楚这个问题,但其实该bug是有条件的,即IE的cache设置为Every...此外有人发现了一个未公开的方法来让IE对背景图进行缓存: document.execCommand(“BackgroundImag

    web开发中常用的input事件汇总

    ### Web开发中常用的Input事件汇总 在Web开发中,`&lt;input&gt;`元素是与用户交互的重要组成部分之一。本文将详细解读一系列与`&lt;input&gt;`相关的事件及其应用案例,特别是通过JavaScript来实现各种实用功能。 #### 打开...

    cument.execCommand()用法深入理解

    `document.execCommand()` 是一个在浏览器环境中用于处理富文本编辑的命令函数,它允许你在用户交互或者脚本中改变文本的格式。这个方法主要用于富文本编辑器,如`&lt;contenteditable&gt;`元素或`&lt;textarea&gt;`元素,使得...

    超级JS代码实例大全

    事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture(); event.srcElement.releaseCapture();...document.execCommand 窗体COOKIE document.cookie 菜单事件

    网页制作必备(最常用javascript onclick语句40条)

    &lt;INPUT onclick="document.execCommand('Underline')" type=button value=»&gt; ``` 对选中文本应用加粗、斜体或下划线格式。 ### 21. 停止加载 ```html &lt;INPUT onclick="document.execCommand('stop')" type=button...

Global site tag (gtag.js) - Google Analytics