Command Identifiers
Command Identifiers

Command identifiers specify an action to take on the given object. Use them with the following methods:

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

Converts the text selection into an ordered list.

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 keys.

Open

Not currently supported.

Outdent

Decreases by one increment the indentation of the format block in which the current selection is located.

OverWrite

Toggles the text-entry mode between insert and overwrite.

Paste

Overwrites the contents of the clipboard on the current selection.

PlayImage

Not currently supported.

Print

Opens the print dialog box so the user can print the current page.

Redo

Not currently supported.

Refresh

Refreshes the current document.

RemoveFormat

Removes the formatting tags from the current selection.

RemoveParaFormat

Not currently supported.

SaveAs

Saves the current Web page to a file.

SelectAll

Selects the entire document.

SizeToControl

Not currently supported.

SizeToControlHeight

Not currently supported.

SizeToControlWidth

Not currently supported.

Stop

Not currently supported.

StopImage

Not currently supported.

StrikeThrough

Not currently supported.

Subscript

Not currently supported.

Superscript

Not currently supported.

UnBookmark

Removes any bookmark from the current selection.

Underline

Toggles the current selection between underlined and not underlined.

Undo

Undo the previous command.

Unlink

Removes any hyperlink from the current selection.

Unselect

Clears the current selection.

Community Content

Too many unsupported features, too weak implementation
Added by:george_5154

I cannot understand why a company with so many programmers working full time such as Microsoft, is unable to support such a simple feature like JustifyFull, specially when 99% of the job is already done.

You cannot select something in a rich-edit control and then transfer the focus to an input type=text control without losing the selection and at the same time allowing the user to type in the input control... Why should any one would ever want to do such a wierd thing? Well, there may be many valid reason, but just let me give you just one example:

Imagine you are developing a blogging web site, and you want to give your users the posibility to create two kinds of links, internals which can be refered by a short alias or blog's name, and externals which can be any valid URL across the Internet. In that case, you don't want to use the browser's user interface while calling execCommand to access the CreateLink command, so the most elegant way to solve this problem is to popup a small box to get the user's choice, but when you transfer the focus to the input control the selection on the rich-text edit control is cleared... hmmmmmm... let me think.... ok, no problem, you just make the input control unselectable... oops... wait... now the user is unable to type anyting!!!!... grrrrrr, ok, ok, ok don't panic lets see what happens in FireFox.... hmmmm... it works fine... let try Safari... also does exactly as I want... hmmm... what about Google Chrome???... let see... also correct... hmmmmmm... [sigh], oh well... back to the code to see if I can tweak it... [24 hours of froustration and 4 cans of bear latter]: My fellow users, I'm sorry to tell you that because the bast mayority of you use Internet Explorer and beacues you are afraid to trow it away, Microsoft has commanded us to go back to the stone age.... I'm so sorry, I'm so sorry for all of us (including Mircrosoft).

Not all that bad...
Added by:tkh2199
Last I checked at the MDC, JustifyFull isn't supported by Mozilla either - nor are many of the other things listed as "unsupported" here. MS is just trying to give you some hints at some future directions. Rich text editing has a long (very long, IMO) way to go yet, in ALL browsers. Remember too, who brought this advancement for browsers forward in the first place. (Hint: it wasn't Mozilla, Safari, Opera, etc.) And until designMode/execCommand has an official standard that is widely accepted, you can't really say whose implementation and behavior is "right" anyway. It's just a de facto thing right now, and will probably stay that way for a good while yet.

As for the specific issue of losing the selection when you set focus elsewhere, I've found I can quite easily avoid those issues by saving the selection before changing focus to whatever input control, then restoring the selection before creating the link or whatever other action I'm doing on the document being edited. See document.selection and it's members for details of manipulating/retrieving the selected ranges in a document in IE.

Every browser has it's frustrations, MS isn't the only one - I find I've lost as much hair to anguished pulling over stupid things in Firefox, Safari, Konqueror, Chrome, and others as I do to IE. Specifically pertaining to rich text editing, Firefox disables events on documents in designmode, which is extremely frustrating for a variety of things. In particular, it makes synchronizing your rich-edit toolbar with the reality at the current cursor position needlessly kludgy: I ended up having to rely on a timer to check things a couple times a second. Reliance on timers for this sort of thing always makes me gag. Whereas in IE I can just attach to a couple of events on the document and synchronize my toolbar when those events occur.

Another example is determining the selected image (say, if you want the user to be able to click a button to edit that image's URL or other properties) is also comparatively much more difficult in Firefox and others than it was in IE. Though all of them could do a better job here, IMO.

Finally, there are plenty of canned, reusable, full-featured RTE implementations out their that work across most browsers and would be more than adequate for blog sites: lay off the beer, get some sleep, and try one of those next time. :-)

actually...
Added by:Mr. Raymond Kenneth Petry
Strikethrough is supported.

And reputedly so are--

Subscript,
Superscript,
Justifyfull....
RE: Too many unsupported features, too weak implementation
Added by:Psi81
Hello george_5154,

if you are able to create a richtext editor i assume that you might have thought about the solution to "buffer" the current selection state and return it as soon as the editor gets focused again. This can easily be done by using the duplicate() method of the selection range, storing its result and calling "select()" after focussing the editor again. If you directly want to apply any changes on the text range without focussing the editor, just work within a (static) copy of the selection.createRange()- object. This will do the same job, all you have to do is just buffer the selection.

There is a simple reason why the selection is not presumed: An iframe (or any html element) and its selection are NOT a richtext editor (and never meant to be). They are just part of an html document which only can have ONE active selection range. If you wish to - forgive the expression - abuse this system to generate a custom control programmed in javascript, you have to implement the desired functionality on your own. I think Microsoft is not responsible for the lack of features that could be desireable for a specific custom control. The DOM gives you alot of power over all the document elements, so to implement a custom control you have to use your brain as well, don't just rely on the work of others...

Greetings
Psi81
© 2010 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View