document.execCommand有点意思

本文详细介绍了HTML编辑器中可用的各种编辑命令,包括设置背景颜色、字体样式、插入链接及图片等操作,为网页内容创作者提供了实用指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[html]
<body onclick=document.execCommand("BackColor","true","#FF0033");>aaaaaaaaaferfrrfswfrewfer
[/html]

[html]
<body onclick=document.execCommand("Bold","true");>aaaaaaaaaferfrrfswfrewfer
[/html]

[html]
<body onselect=document.execCommand("copy","true");>aaaaaaaaaferfrrfswfrewfer
<textarea onfocus=document.execCommand("paste","true")></textarea>
[/html]

Command Identifiers
2D-Position
Allows absolutely positioned elements to be moved by dragging.

AbsolutePosition
Sets an element's position property to "absolute."

BackColor
Sets or retrieves the background color of the current selection.

BlockDirLTR
Not currently supported.

BlockDirRTL
Not currently supported.

Bold
Toggles the current selection between bold and nonbold.

BrowseMode
Not currently supported.

ClearAuthenticationCache
Clears all authentication credentials from the cache. Applies only to execCommand.

Copy
Copies the current selection to the clipboard.

CreateBookmark
Creates a bookmark anchor or retrieves the name of a bookmark anchor for the current selection or insertion point.

CreateLink
Inserts a hyperlink on the current selection, or displays a dialog box enabling the user to specify a URL to insert as a hyperlink on the current selection.

Cut
Copies the current selection to the clipboard and then deletes it.

Delete
Deletes the current selection.

DirLTR
Not currently supported.

DirRTL
Not currently supported.

EditMode
Not currently supported.

FontName
Sets or retrieves the font for the current selection.

FontSize
Sets or retrieves the font size for the current selection.

ForeColor
Sets or retrieves the foreground (text) color of the current selection.

FormatBlock
Sets the current block format tag.

Indent
Increases the indent of the selected text by one indentation increment.

InlineDirLTR
Not currently supported.

InlineDirRTL
Not currently supported.

InsertButton
Overwrites a button control on the text selection.

InsertFieldset
Overwrites a box on the text selection.

InsertHorizontalRule
Overwrites a horizontal line on the text selection.

InsertIFrame
Overwrites an inline frame on the text selection.

InsertImage
Overwrites an image on the text selection.

InsertInputButton
Overwrites a button control on the text selection.

InsertInputCheckbox
Overwrites a check box control on the text selection.

InsertInputFileUpload
Overwrites a file upload control on the text selection.

InsertInputHidden
Inserts a hidden control on the text selection.

InsertInputImage
Overwrites an image control on the text selection.

InsertInputPassword
Overwrites a password control on the text selection.

InsertInputRadio
Overwrites a radio control on the text selection.

InsertInputReset
Overwrites a reset control on the text selection.

InsertInputSubmit
Overwrites a submit control on the text selection.

InsertInputText
Overwrites a text control on the text selection.

InsertMarquee
Overwrites an empty marquee on the text selection.

InsertOrderedList
Toggles the text selection between an ordered list and a normal format block.

InsertParagraph
Overwrites a line break on the text selection.

InsertSelectDropdown
Overwrites a drop-down selection control on the text selection.

InsertSelectListbox
Overwrites a list box selection control on the text selection.

InsertTextArea
Overwrites a multiline text input control on the text selection.

InsertUnorderedList
Toggles the text selection between an ordered list and a normal format block.

Italic
Toggles the current selection between italic and nonitalic.

JustifyCenter
Centers the format block in which the current selection is located.

JustifyFull
Not currently supported.

JustifyLeft
Left-justifies the format block in which the current selection is located.

JustifyNone
Not currently supported.

JustifyRight
Right-justifies the format block in which the current selection is located.

LiveResize
Causes the MSHTML Editor to update an element's appearance continuously during a resizing or moving operation, rather than updating only at the completion of the move or resize.

MultipleSelection
Allows for the selection of more than one site selectable element at a time when the user holds down the SHIFT or CTRL

http://bbs.blueidea.com/viewthread.php?tid=1042042
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值