The Javascript Environment; Javascript Objects In The Golive Environment; Objects, Elements, And Properties; Accessing Attribute Values - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

3

The JavaScript Environment

This chapter discusses JavaScript and ECMAScript/ExtendScript concepts and usage in GoLive, including:

JavaScript Objects in the GoLive Environment

Scope of Variables and Functions
Handling Events
Sharing Data
Delays and Timeouts
JavaScript Objects in the GoLive Environment
GoLive provides access to data and objects in a way that JavaScript programmers will find familiar. Those
new to JavaScript will discover that the GoLive environment usually provides multiple ways to access data
and objects. This section describes various ways an extension's JavaScript code can access data and
objects in the GoLive environment.

Objects, elements, and properties

GoLive JavaScript objects can represent parts of a document, or GoLive components:
When GoLive loads a markup document, it generates objects to represent the markup tree of a
document. Collectively, the objects that represent portions of the markup document are known as
markup
attributes), and also comments, text blocks, and other types of markup such as entities or CDATA
sections.
When GoLive loads an extension definition file (that is, the Main.html file for your extension), it
creates JavaScript objects to represent the GoLive components you define, such as windows, UI
controls, and menu items. For example, a <jsxdialog> element in your extension definition results in
a
window
There are various ways to obtain a reference to a JavaScript object, depending on the object's type.
You can retrieve most component objects by name from global properties, such as the menus and
dialogs collections.
Objects that represent HTML page content are available from the markup tree; you get the root object
from the
properties and methods allow you to navigate the tree.
GoLive passes relevant objects as event-object property values to event-handling functions.
For information on retrieving a particular object, see that object's description in the GoLive CS2 SDK
Programmer's Reference.

Accessing attribute values

The attributes of an element (whether it is a document markup element or an element in your extension
definition) appear as the properties of the corresponding JavaScript object. For example, the name
objectss. Markup objects can represent HTML markup elements (as defined by a tag and its
Object.
document Object
for the page ( document.documentElement ), and that object's
27

Advertisement

Table of Contents
loading

Table of Contents