Javascript Libraries - Adobe GOLIVE CS2 User Manual

Hide thumbs Also See for GOLIVE CS2:
Table of Contents

Advertisement

JavaScript sample code and result
The
document.write()
method on the "Your Local Time" line writes an H1-formatted text string from the
document to the screen of the browser.
The new
Date()
method creates a new date object containing the long version of the current date from the viewer's
operating system. This object is assigned to currtime.
The last line is output to the browser's screen using a
variable set to the current time and date.

JavaScript libraries

Shifting code to an external library
GoLive can automatically create an external JavaScript library file that stores shared code from JavaScript actions,
rollovers, dynamic components, and animated scenes created in the DHTML Timeline Editor. At the same time, it
replaces the shared code in the page with a reference to the library file, leaving only page-specific declarations and
parameters in place. The library is then uploaded to the web server to make it available for every page in the site that
needs the script.
Benefits of using external JavaScript libraries
Apart from streamlining the code in your pages, this library offers two advantages:
It remedies a problem associated with the structure of dynamic GoLive components: GoLive invariably places
common code for DHTML items and actions in the head section of a page. While this structure works well with
"straight" pages, problems could occur in earlier versions when a dynamic component contained DHTML items
and scripted actions. As the browser loads only the body section of a dynamic component, it ignores any script
code contained in the head section. This problem can be solved by using the external JavaScript library, making
JavaScript code in dynamic components work as expected.
The browser caches the JavaScript library file and less code is written into every page, making the pages load faster.
The JavaScript library
You can choose the external JavaScript library feature on a per-page basis, as a site-wide setting, or as an application­
wide preference. If you choose the option in the application preferences or site settings, all new pages and existing
pages without preexisting JavaScript will use the new preference setting. Pages that already had actions and other
JavaScript added to them will retain their existing JavaScript Functions setting. You must change the setting for these
pages in the HTML tab of the Page Inspector.
document.write()
method, with the embedded
ADOBE GOLIVE CS2
605
User Guide
currtime

Advertisement

Table of Contents
loading

Table of Contents