共用方式為


Commands A-C (JavaScript)

Command identifiers A-C for JavaScript.

  • 2D-Position
  • AbsolutePosition
  • BackColor
  • BackgroundImageCache
  • ms-beginUndoUnit
  • BlockDirLTR
  • BlockDirRTL
  • Bold
  • BrowseMode
  • ClearAuthenticationCache
  • ms-clearUndoStack
  • Copy
  • CreateBookmark
  • CreateLink
  • Cut

2D-Position

Allows absolutely positioned elements to be moved by dragging.

Command 2D-Position

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Required. Variant of type Boolean specifying whether this feature is to be on or off.

AbsolutePosition

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

Command AbsolutePosition

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Required. Variant of type Boolean specifying whether the element is to be absolutely positioned.

This command only applies to site selectable elements. In addition, AbsolutePosition only affects inline styles. If the page defines absolute positioning for the element in a style block, AbsolutePosition will not be able to affect the element's positioning property.

BackColor

Sets or retrieves the background color of the current selection.

Command BackColor

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Required. Variant of type String that specifies a color name or a six-digit hexadecimal RGB value, with or without a leading hash mark, as defined in the Color Table.

The HTML generated by this command may vary depending on the version of Windows Internet Explorer.

BackgroundImageCache

Caches background image(s).

Command BackgroundImageCache

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Required. Variant of type Boolean specifying whether this feature is to be on or off.

document.execCommand("BackgroundImageCache", false, true);

ms-beginUndoUnit

Starts an undo unit. Any DOM changes between ms-beginUndoUnit and ms-endUndoUnit (including any changes from script) are collected into an undo unit and undone and redone as if they were a single command.

If an undo unit is started through ms-beginUndoUnit and any of the following conditions is met, the current undo unit will be ended automatically:

  • When the user does something that would be an undo-able action, such as typing some text.
  • When the current script completes execution and returns to the event loop.
  • When an undo or redo occurs, either when initiated by the user or by execCommand(“undo”/”redo”).
  • When undo data is cleared by execCommand(“ms-clearUndoStack”).

Undo units cannot be nested. If ms-beginUndoUnit and ms-endUndoUnit are called within another pair of commands, only a single unit will be created to span all editing operations from the first ms-beginUndoUnit to the last ms-endUndoUnit.

Command ms-beginUndoUnit
Minimum availability Internet Explorer 11

 

Call execCommand with the following parameters.

  • bUserInterface
    Optional. Set to false.

  • vValue
    Optional.

document.execCommand("ms-beginUndoUnit");

BlockDirLTR

Not supported.

Command BlockDirLTR

 

BlockDirRTL

Not supported.

Command BlockDirRTL

 

Bold

Toggles the current selection between bold and nonbold.

Command Bold

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Optional.

BrowseMode

Not supported.

Command BrowseMode

 

ClearAuthenticationCache

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

Command ClearAuthenticationCache

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Optional.

ms-clearUndoStack

Clears the undo history.

Command ms-clearUndoStack
Minimum availability IE11

 

Call execCommand with the following parameters.

  • bUserInterface
    Optional. Set to false.

  • vValue
    Optional.

document.execCommand("ms-clearUndoStack");

Copy

Copies the current selection to the clipboard.

Command Copy

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Optional.

CreateBookmark

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

Command CreateBookmark

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Required. Variant of type String that specifies a valid anchor name. Providing an empty string will cause the command to fail.

The HTML generated by this command may vary depending on the version of Internet Explorer.

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.

Command CreateLink

 

Call execCommand with the following parameters.

  • bUserInterface
    Optional. This command displays a dialogue box if the bUserInterface argument of execCommand is set to true or omitted. It does not display a dialogue box if the argument is set to false or null and the vValue parameter is present (even if it's null).

  • vValue
    Optional. Variant of type String that specifies a URL.

vValue is only valid if the bUserInterface argument of execCommand is set to false or null. Providing an empty string will create the anchor tag but will leave the name attribute blank.

The HTML generated by this command may vary depending on the version of Internet Explorer.

Although this command is available for Windows Store app using JavaScript, it is recommended that you provide a user interface (UI) if you want to allow users to enter the URL.

Cut

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

Command Cut

 

Call execCommand with the following parameters.

  • bUserInterface
    Set to false.

  • vValue
    Optional.