Using JavaScript in HomeSite 4.0, Part II: The ActiveDocument Object's Properties | WebReference

Using JavaScript in HomeSite 4.0, Part II: The ActiveDocument Object's Properties


Using JavaScript in HomeSite 4.0, Part II

The ActiveDocument Object's Properties

The ActiveDocument Object is very useful in manipulating the active document, i.e. the document currently visible in the editing window. We describe its properties and methods in this and next few pages of the column. Here are its properties:

CanUndo Read-only Boolean

Returns a true value if recent changes can be undone.

CanRedo Read-only Boolean

Returns a true value if recent changes can be re-done.

Filename Read-only String

Returns the file name of the active document.

Lines(index) Read-Write String

Gets or sets the line at the specified index. For example, the JavaScript line app.ActiveDocument.Lines(1) gets the contents of the active document's second line. The following code sets this line to "Hello There":

app.ActiveDocument.Lines(1) = "Hello There";
LineCount Read-only Integer

Returns the number of lines in the active document.

Modified Read-only Boolean

Returns a true value if the active document has been modified since it was last saved to disk.

ReadOnly Read-only Boolean

Returns a true value if the active document is read-only.

SelStart Read-Write Integer

Gets or sets the selection portion's starting character index, counting from the beginning of the document. When setting this property, the cursor is positioned at the specified position. See also SelLength.

SelLength Read-Write Integer

Gets or sets the selection portion's character length. See also SelStart.

SelText Read-Write String

Gets or sets the selection portion's contents. See also SelStart.

TabIndex Read-Write String

Gets or sets the tab index of the active document. Setting this property does not seem to be working.

Text Read-only String

Gets or sets the contents of the active document.

https://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

Created: September 27, 1999
Revised: September 27, 1999

URL: https://www.webreference.com/js/column49/activeprop.html