Availability: |
| |||
Property/method value type: | Boolean primitive | |||
JavaScript syntax: | IE | myDocument.execCommand(aCommand) | ||
IE | myDocument.execCommand(aCommand, aUIFlag) | |||
IE | myDocument.execCommand(aCommand, aUIFlag, aParameter) | |||
Argument list: | aCommand | An MSIE command to execute | ||
aParameter | Parameter value to the command | |||
aUIFlag | Display or inhibit UI appearance |
The MSIE browser supports a special command handling interface that hooks through the browser's user interface. It allows you to automate user actions in a way that other browsers and non-Windows platform users cannot take advantage of.
Although this is a method that applies to a document object, many of the commands that are executed through this mechanism will require that a TextRange object is created and available first.
The result returned by this method, is a Boolean true if the action succeeded, and a Boolean false if it failed in someway.
The flag parameter provides a way to suppress any user interface changes that may appear as a result of executing the command.
Name | Description |
---|---|
2D-Position | Absolutely positioned elements can be moved by dragging. |
AbsolutePosition | Sets an element's position property to "absolute" |
BackColor | The background color for the current selection is set to the color value passed in the parameter argument. |
Bold | The selected text has <B> and </B> tags placed at either end. |
Copy | The TextRange is copied to the clipboard. |
CreateBookmark | Carries out modifications to an existing <A> tag or creates one, then adds the item to the bookmarks list. The parameter provides the NAME value. The <A> tag is removed if there is no parameter. |
CreateLink | Wraps an <A HREF="..."> tag around the selected text. The parameter contains the URL value for the HREF. |
Cut | Performs a cut to clipboard. |
Delete | The text range is deleted. This is not the same as a Cut command. |
FontName | Wraps <FONT> tags round the selection. The required font face is passed in the parameter. |
FontSize | Wraps <FONT> tags round the selection and defines the fonts size from the parameter value. |
ForeColor | Redefines the foreground btext color for the selection taking the color value from the parameter. |
FormatBlock | Wraps a <BLOCK> tag round the TextRange. |
Indent | The TextRange is indented |
InsertButton | A <BUTTON> tag is placed at the current insertion point in the document. Its ID value is defined by the parameter. |
InsertFieldset | A <FIELDSET> tag is inserted with theID value being taken from the parameter |
InsertHorizontalRule | An <HR> tag is added at the current insertion point. |
InsertIFrame | A new <IFRAME> is inserted with the content URL being provided in the parameter. |
InsertImage | Overwrites an image on the current selection. |
InsertInputButton | An <INPUT TYPE="Button"> is added with its ID value coming from the parameter. |
InsertInputCheckbox | An <INPUT TYPE="Checkbox"> is added with its ID value coming from the parameter. |
InsertInputFileUpload | An <INPUT TYPE="FileUpload"> is added with its ID value coming from the parameter. |
InsertInputHidden | An <INPUT TYPE="Hidden"> is added with its ID value coming from the parameter. |
InsertInputImage | An <INPUT TYPE="Image"> is added with its ID value coming from the parameter. |
InsertInputPassword | An <INPUT TYPE="Password"> is added with its ID value coming from the parameter. |
InsertInputRadio | An <INPUT TYPE="Radio"> is added with its ID value coming from the parameter. |
InsertInputReset | An <INPUT TYPE="Reset"> is added with itsID value coming from the parameter. |
InsertInputSubmit | An <INPUT TYPE="Submit"> is added with itsID value coming from the parameter. |
InsertInputText | An <INPUT TYPE="Text"> is added with its ID value coming from the parameter. |
InsertMarquee | A new <MARQUEE> is added with the ID being taken from the parameter. |
InsertOrderedList | A new <OL> is added with the ID being taken from the parameter. |
InsertParagraph | A new <P> is added with the ID being taken from the parameter. |
InsertSelectDropdown | A new <SELECT TYPE="select-one"> is added with the ID being taken from the parameter. |
InsertSelectListbox | A new <SELECT TYPE="select-multiple"> is added with the ID being taken from the parameter. |
InsertTextArea | A new <TEXTAREA> is added with the ID being taken from the parameter. |
InsertUnordredList | A new <UL> is added with the ID being taken from the parameter. |
Italic | The TextRange is enclosed with <I> tags. |
JustifyCenter | The TextRange is centered within its parent object. |
JustifyFull | The TextRange is fully justified. |
JustifyLeft | The TextRange is left justified. |
JustifyRight | The TextRange is right justified. |
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. |
Outdent | The complement of the Indent command. |
OverWrite | The input-typing mode is set to overwrite if the parameter value is true and insert if it is false. |
Paste | The contents of the clipboard are pasted into the TextRange. |
PlayImage | If an image represents a video clip, then it starts playing. |
Refresh | The document is reloaded. |
RemoveFormat | The complement of the FormatBlock command. |
SaveAs | Saves the current Web page to a file. |
SelectAll | The entire document text is selected. |
StopImage | The complement of the PlayImage command. |
UnBookmark | The complement of the CreateBookmark command. |
Underline | Places <U> tags around the TextRange. |
Unlink | The complement of the CreateLink command. |
Unselect | Unselects whatever was selected to create the TextRange. Many commands are now inappropriate until a new TextRange has been created. |
None of these commands provide any greatly significant functionality as far as dynamic HTML is concerned. A few of them allow you to manage the clipboard and bookmark lists. It is probably best to avoid using these commands and use the more usual ways of accessing the document internals.
Prev | Home | Next |
Document.embeds[] | Up | Document.expando |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |