Validate Document Objects; Working With Style Sheets; Creating A New Html Page - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
if (documents.length > 1)
{
}
// otherwise, process documents here
}

Validate document objects

The frontmost window can display various kinds of documents. A document object can represent a
markup document, a site document, or some other kind of document. Test the type property to make
sure you have the right type of document before working with it.
When no document is open, the global document variable returns null or undefined. Otherwise, it holds
a document object.
When the Site window is frontmost, this object's type="site" .
When the object represents a markup document, its type="markup" .
For all other documents, such as plain text documents, image files, and so on, type="unknown" .

Working with style sheets

When an HTML document contains CSS style information, the document object's
provides access to that information. You can examine the style information through the
Objects found here, and the rule objects that are referenced by the style-sheet objects.
Access through the original markup document is read-only. To add or modify style information, you must
load the associated style-sheet file as a separate document. The resulting document object has the type
css . You can open and edit it interactively or programmatically as you would a markup document.
For a document of type markup, the styleSheets property contains an array of CSSStyleSheet
objects for all embedded and imported style sheets.
For a document of type stylesheet , the styleSheets property contains an array with only one
element, the CSSStyleSheet object for that style sheet.

Creating a new HTML page

to create a new HTML page and display it in a document window, call the
method:
var theDoc = app.newDocument();
if (theDoc)
{
}
This is equivalent to choosing the File > New Page menu item in GoLive. It creates an HTML document that
holds default content, and automatically displays it in a document window.
Window.alert("Make sure only one document is open and try again.");
return;
// do something with doc here
Adobe GoLive CS2 SDK
Editing Documents Programmatically
styleSheets
CSSStyleSheet
app
Object's
newDocument
99
property

Advertisement

Table of Contents
loading

Table of Contents