home / experts / javascript / column39 |
|
|
You have previously seen the HTA's window. Click here to examine it again. This window can be further customized to your taste by the HTA:APPLICATION tag. Its attributes tell the window how to appear and behave as an application. The HTA:APPLICATION tag should be included in the <HEAD> section of the HTA. Let's take an example:
<HEAD>
<TITLE> My Simple Application</TITLE>
<HTA:APPLICATION ID = "htaObj"
APPLICATOINNAME = "docjavascript"
BORDER = "none"
CAPTION = "no"
SHOWINTASKBAR = "yes"
SINGLEINSTANCE = "yes"
SYSMENU = "no"
WINDOWSTATE = Maximize
>
</HEAD>
All attributes can be accessed from JavaScript via an HTA object identified by the ID attribute. The following script prints the name of the HTA application:
<HTML>
<HEAD>
<TITLE> My Simple Application</TITLE>
<HTA:APPLICATION ID = "htaObj"
APPLICATIONNAME = "docjavascript"
>
</HEAD>
<SCRIPT>
alert("applicationName = " + htaObj.applicationName);
</SCRIPT>
<BODY>
This is Doc JavaScript's HTA<BR>
<BUTTON onclick="self.close()">Go Away</BUTTON>
</BODY>
</HTML>
The following table summarizes all attributes and properties and how they affect the look and feel of the HTA window:
| HTML Attribute | APPLICATIONNAME |
| Description | Sets (retrieves in JavaScript) the application name. |
| Possible Values | A String |
| Examples | APPLICATIONNAME= "docjavascript" |
| Remarks | Must be set and unique for the SINGLEINSTANCE to work. |
| JavaScript Property | applicationName |
| Permission | Read Only |
| Default | No |
| HTML Attribute | BORDER |
| Description | Sets or retrieves the HTA border. |
| Possible Values | "thick", "dialog window", "thin", "none" |
| Examples | BORDER= "thin" |
| Remarks | Only valid for HTA windows that contain a title bar, or caption. The value "none" eliminates the program icon and Minimize/Maximize buttons. Can be used with the borderStyle property, which controls the content border within the window. Differences may not be detected. |
| JavaScript Property | border |
| Permission | Read Only |
| Default | "thick" |
| HTML Attribute | BORDERSTYLE |
| Description | Sets or retrieves the HTA content border. |
| Possible Values | "normal", "complex", "raised", "static", "sunken" |
| Examples | BORDERSTYLE= "normal" |
| Remarks | Affects only the content border. Use BORDER to affect the outer border of the window. |
| JavaScript Property | borderStyle |
| Permission | Read Only |
| Default | "normal" |
| HTML Attribute | CAPTION |
| Description | Sets or determines whether the HTA window has a title bar. |
| Possible Values | "yes", "no" |
| Examples | CAPTION = "yes" |
| Remarks | Turning off the caption will remove the application icon, and the Minimize and Maximize buttons. Provide a button to exit the application! |
| JavaScript Property | caption |
| Permission | Read Only |
| Default | "yes" |
| HTML Attribute | commandLine |
| Description | Retrieves the command line and arguments that invoked the HTA. |
| Possible Values | Read Only |
| Examples | command = htaObj.commandLine |
| Remarks | Returns an empty string when HTA invoked via HTTP. |
| JavaScript Property | commandLine |
| Permission | Read Only |
| Default | No Default |
| HTML Attribute | ICON |
| Description | Sets or retrieves the icon file name. |
| Possible Values | A String |
| Examples | ICON = "3DSmiley.ico" |
| Remarks | Need to use a 32x32 icon. |
| JavaScript Property | icon |
| Permission | Read Only |
| Default | System Application Icon |
| HTML Attribute | MAXIMIZEBUTTON |
| Description | Sets or determines whether the HTA window has a Maximize button. |
| Possible Values | "yes", "no" |
| Examples | MAXIMIZEBUTTON = "yes" |
| Remarks | Must turn on CAPTION to have the Maximize button. |
| JavaScript Property | maximizeButton |
| Permission | Read Only |
| Default | "yes" |
| HTML Attribute | MINIMIZEBUTTON |
| Description | Sets or determines whether the HTA window has a Minimize button. |
| Possible Values | "yes", "no" |
| Examples | MINIMIZEBUTTON = "yes" |
| Remarks | Must turn on CAPTION to have the Maximize button. |
| JavaScript Property | minimizeButton |
| Permission | Read Only |
| Default | "yes" |
| HTML Attribute | SHOWINTASKBAR |
| Description | Sets or determines whether the HTA appear in the task bar. |
| Possible Values | "yes", "no" |
| Examples | SHOWINTASKBAR = "yes" |
| Remarks | Does not affect the applications shown by ALT+TAB |
| JavaScript Property | showInTaskBar |
| Permission | Read Only |
| Default | "yes" |
| HTML Attribute | SINGLEINSTANCE |
| Description | Sets or determines whether only one instance of the application is allowed. |
| Possible Values | "yes", "no" |
| Examples | SINGLEINSTANCE = "no" |
| Remarks | Application is determined by APPLICATONNAME and not by the URL. Click twice on the links to the left. |
| JavaScript Property | singleInstance |
| Permission | Read Only |
| Default | "no" |
| HTML Attribute | SYSMENU |
| Description | Sets or determines whether the HTA has system menus (icon and Maximize and Minimize buttons). |
| Possible Values | "yes", "no" |
| Examples | sysMenu = "yes" |
| Remarks | Can drastically affect the look and feel of the application. |
| JavaScript Property | sysMenu |
| Permission | Read Only |
| Default | "yes" |
| HTML Attribute | VERSION |
| Description | Sets or determines the HTA version. |
| Possible Values | A String |
| Examples | version = "5.3" |
| Remarks | The entered version will appear in the application's properties, if you save to disk. |
| JavaScript Property | version |
| Permission | Read Only |
| Default | "" |
| HTML Attribute | WINDOWSTATE |
| Description | Sets or determines the HTA window size. |
| Possible Values | "normal", "maximize", "minimize" |
| Examples | WINDOWSTATE = "minimize" |
| Remarks | "normal" means window will inherit the Internet Explorer default window. "maximize" will expand the window to a full screen. "minimize" will put the application icon on the task bar. |
| JavaScript Property | windowState |
| Permission | Read Only |
| Default | "normal" |
Produced by Yehuda Shiran and Tomer Shiran
Created: May 12, 1999
Revised: May 12, 1999
URL: http://www.webreference.com/js/column39/customize.html