The Document interface supports the following properties, in addition to those inherited from the DOMNode interface.
BodyAttribute(strAttrName) | |
Access | Read/write |
Type | String |
Description | Returns or sets the value of the strAttrName attribute of the BODY element. |
Usage | |
JScript |
vbl = Document_object.BodyAttribute(strAttrName); Document_object.BodyAttribute(strAttrName) = value; |
VBScript |
vbl = Document_object.BodyAttribute(strAttrName) Document_object.BodyAttribute(strAttrName) = value; |
Example |
// SoftQuad Script Language JSCRIPT: var bgcolor=ActiveDocument.BodyAttribute("BGCOLOR"); Application.Alert("Body background color=" + bgcolor); // Set to red ActiveDocument.BodyAttribute("BGCOLOR")="#ff0000"; |
CustomDocumentProperties | |
Access | Read-only |
Type | DocumentProperties |
Description | Returns a DocumentProperties object containing the custom properties for the document. |
Usage | |
JScript | Document_object.CustomDocumentProperties; |
VBScript | Document_object.CustomDocumentProperties |
Example |
// SoftQuad Script Language JSCRIPT: // Display the number of custom properties var docProps; docProps=ActiveDocument.CustomDocumentProperties; Application.Alert(docProps.Count); |
doctype (Implements DOM) | |
Access | read |
Type | DOMDocumentType |
Description | Returns a DOMDocumentType object, which contains information about the DTD and document type declaration (DOCTYPE) of the document. Returns a null string if the document has no DOCTYPE. |
Usage | |
JScript | Document_object.doctype; |
VBScript | Document_object.doctype |
Example |
// SoftQuad Script Language JSCRIPT: // Display the document type name Application.Alert(ActiveDocument.doctype.name); |
documentElement (Implements DOM) | |
access | Read-only |
Type | DOMElement |
Description | Provides access to the node corresponding to the root (top-level) element of the document. In HTML files, this element is always HTML. |
Usage | |
JScript | Document_object.documentElement; |
VBScript | Document_object.documentElement |
Example |
// SoftQuad Script Language JSCRIPT: var elem; elem=ActiveDocument.documentElement; Application.Alert(elem.nodeName); |
DocumentTitle | |
Access | Read/write |
Type | String |
Description | Retrieves or inserts text in the TITLE element. |
Usage | |
JScript |
vbl = Document_object.DocumentTitle; Document_object.DocumentTitle = strTitle; |
VBScript |
vbl = Document_object.DocumentTitle Document_object.DocumentTitle = strTitle |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.DocumentTitle); ActiveDocument.DocumentTitle="a new title!"; Application.Alert(ActiveDocument.DocumentTitle); |
FullName | |
Access | Read-only |
Type | String |
Description | The full path and file name of the active document. See also name and Path. If the document has never been saved, an empty string is returned. |
Usage | |
JScript | Document_object.FullName; |
VBScript | Document_object.FullName |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.FullName); |
implementation (Implements DOM) | |
Access | Read-only |
Type | DOMImplementation |
Description | The DOMImplementation object that handles this document. |
Usage | |
JScript | Document_object.implementation; |
VBScript | Document_object.implementation |
Example |
// SoftQuad Script Language JSCRIPT: var curImpl, xmlFeature; curImpl= ActiveDocument.implementation; xmlFeature=curImpl.hasFeature("XML","1.0"); Application.Alert(xmlFeature); xmlFeature=curImpl.hasFeature("XML","2.0"); Application.Alert(xmlFeature); |
InCurrentProject | |
Access | Read-only |
Type | Boolean |
Description | Indicates whether the document is in the current project. |
Usage | |
JScript | Document_object.InCurrentProject; |
VBScript | Document_object.InCurrentProject |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.InCurrentProject); |
IsHTML | |
Access | Read-only |
Type | Boolean |
Description | Returns true if HoTMetaL PRO is editing this document as an HTML document. |
Usage | |
JScript | Document_object.IsHTML; |
VBScript | Document_object.IsHTML |
Example |
// SoftQuad Script Language JSCRIPT: if (ActiveDocument.IsHTML) { Application.Alert("This is an HTML document."); } |
IsSGML | |
Access | Read-only |
Type | Boolean |
Description | Returns true if the document is an SGML document. |
Usage | |
JScript | Document_object.IsSGML; |
VBScript | Document_object.IsSGML |
Example |
// SoftQuad Script Language JSCRIPT: if (ActiveDocument.IsSGML) { Application.Alert("This is an SGML document."); } |
IsValid | |
Access | Read-only |
Type | Boolean |
Description | Indicates whether the document is valid. Displays no messages to the user. See also Document.Validate , Selection.Validate, and Selection.IsValid. |
Usage | |
JScript | Document_object.IsValid; |
VBScript | Document_object.IsValid |
Example |
// SoftQuad Script Language JSCRIPT: if (ActiveDocument.IsValid) { Application.Alert("Document is valid!"); } else { Application.Alert("Document is not valid!"); } |
IsXML | |
Access | Read-only |
Type | Boolean |
Description | Returns true if the document is an XML document. |
Usage | |
JScript | Document_object.IsXML; |
VBScript | Document_object.IsXML |
Example |
// SoftQuad Script Language JSCRIPT: if (ActiveDocument.IsXML) { Application.Alert("This is an XML document."); } |
MacroFile | |
Access | Read-only |
Type | String |
Description | Returns the full path to the macro file for this document (that is, the macro file for this document's rules file). See also Application.MacroFile . |
Usage | |
JScript | Document_object.MacroFile; |
VBScript | Document_object.MacroFile |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.MacroFile); |
name | |
Access | Read-only |
Type | String |
Description | The file name (not including the path) of the document. |
Usage | |
JScript | myFileName=Document_object.name; |
VBScript | myFileName=Document_object.name |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.name); |
Path | |
Access | Read-only |
Type | String |
Description | The path (not including the filename) of the document. |
Usage | |
JScript | pathToFile=Document_object.Path; |
VBScript | pathToFile=Document_object.Path |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.Path); |
Range | |
Access | Read-only |
Type | Range |
Description | Creates and returns a Range object corresponding to the user's selection in the document. |
Usage | |
JScript | Document_object.Range; |
VBScript | Document_object.Range |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.Range.ContainerName); |
Saved | |
Access | Read/write |
Type | Boolean |
Description | Indicates whether the active document has been saved since changes were last made. Set is not implemented; use the Document.Save method instead . |
Usage | |
JScript | Document_object.Saved; |
VBScript | Document_object.Saved |
Example |
// SoftQuad Script Language JSCRIPT: if (!ActiveDocument.Saved) ActiveDocument.Save(); |
Title | |
Access | Read/write |
Type | String |
Description | Gets or sets the window title for the document. |
Usage | |
JScript |
vbl = Document_object.Title; Document_object.Title = strTitle; |
VBScript |
vbl = Document_object.Title Document_object.Title = strTitle |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.Title); ActiveDocument.Title="The Donkey Farm"; Application.Alert(ActiveDocument.Title); |
ViewType | |
Access | Read/write |
Type | Integer |
Description |
Returns or sets the HoTMetaL PRO document view that the document is displayed in. Allowed
values are:
|
Usage | |
JScript |
vbl = Document_object.ViewType; Document_object.ViewType = intViewType; |
VBScript |
vbl = Document_object.ViewType Document_object.ViewType = intViewType |
Example |
// SoftQuad Script Language JSCRIPT: // If in Normal View, switch to Tags On if (ActiveDocument.ViewType==0) { ActiveDocument.ViewType=1; } |
Copyright © SoftQuad Software Inc. 1999