spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column48


Using JavaScript in HomeSite 4.0, Part I

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Writing Scripts

When you execute a script within HomeSite (by clicking one of your custom buttons), the application invokes the script's Main routine. For example, if you're using JavaScript (JScript), your script should have the following structure:

function Main() {

}

You can also include additional global variables and functions, as shown in the following script:

var app = Application;
function Main() {
  app.CloseAll(true);
}

Just like C++, HomeSite executes the script by calling the Main() function. Note that the physical position of the function related to other variables and functions doesn't matter. HomeSite executes any global statement in the script file before it executes the Main() function. If you're familiar with the implementation of JavaScript in HTML documents, this behavior will remind you of the onLoad event handler, because it runs only after the entire page has loaded.

We mentioned earlier that HomeSite supports JScript and VBScript. You obviously can't use both languages in one script, so the program must know what language you are using. HomeSite determines which language engine to use based on the extension of the script file. The extensions .bas, .vb, and .vbs refer to VBScript, while any other extension represents a JavaScript source.

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: September 13, 1999
Revised: September 13, 1999

URL: http://www.webreference.com/js/column48/write.html