HTA的简单应用

HTA是HTML Application的缩写(HTML应用程序),是软件开发的新概念,直接将HTML保存成HTA的格式,就是一个独立的应用软件,它通过mshta.exe来执行,与VB、C++等程序语言所设计的软件没什么差别。

一个简单的HTA例子

<html>
<head>
<title>一个简单的HTA例子</title>
<style>
p {font-size:24;cursor:hand}
</style>
</head>
<body>
<p>Hello world!</p>
</body>
</html>

把上面的代码复制到任意文本编辑器中,然后保存为*.hta,直接双击就可以看到效果啦!

HTA属性

从例子可以看出来,HTA与普通的网页结构差不多,它对语法的要求比HTML还要松,甚至连<html>、<body>等标记都可以省略,所以设计出来很容易。当然HTA还有许多自己独特的属性,通过这些属性我们可以设置HTA应用程序的外观:

1.APPLICATION
Indicates whether the content of the object is an HTML Application (HTA) and, therefore, exempt from the browser security model.
表示对象内容是否为一个HTML应用程序,
值为yes/no

2.applicationName
Sets or retrieves the name of the HTML Application (HTA).
设置或者获取HTA的名称
值:自定义

3.border
Sets or retrieves the type of window border for the HTML Application (HTA).
设置边框模式
值为:thick/thin/dialog/none

4.borderStyle
Sets or retrieves the style set for the content border within the HTML Application (HTA) window.
设置边框样式
值为:normal/complex/raised/static/sunken

5.caption
Sets or retrieves a Boolean value that indicates whether the window is set to display a title bar or caption, for the HTML Application (HTA).
是否显示标题栏
值为yes/no

6.commandLine
Retrieves the argument used to launch the HTML Application (HTA).
用于获取当前HTA应用程序的路径

7.contextMenu
Sets or retrieves whether the context menu is displayed when the right mouse button is clicked.
设置或者获取反键菜单是否可用
值为yes/no

8.icon
Sets or retrieves the name and location of the icon specified in the HTML Application (HTA).
设置HTA的图标路径
值为一个图标路径

9.innerBorder
Sets or retrieves whether the inside 3-D border is displayed.
是否显示内边框
值为yes/no

10.maximizeButton
Sets or retrieves a Boolean value that indicates whether a Maximize button is displayed in the title bar of the HTML Application (HTA) window.
是否显示最大化按钮
值为yes/no

11.minimizeButton
Sets or retrieves a Boolean value that indicates whether a Minimize button is displayed in the title bar of the HTML Application (HTA) window.
是否显示最小化按钮
值为yes/no

12.navigable
Sets or retrieves whether linked documents will be loaded in the main HTA window or in a new browser window.
设置HTA程序中的链接是在浏览器中打开,还是
在当前窗口打开.
值为yes/no

13.scroll
Sets or retrieves whether the scroll bars are displayed.
是否显示滚动条
值为yes/no/auto

14.scrollFlat
Sets or retrieves whether the scroll bar is 3-D or flat.
设置滚动条是3D样式的,还是2D平板样式
值为yes/no

15.selection
Sets or retrieves whether the content can be selected with the mouse or keyboard.
设置HTA中的文字是否可选
值为yes/no

16.showInTaskBar
Sets or retrieves a value that indicates whether the HTML Application (HTA) is displayed in the Windows taskbar.
设置HTA是否显示在任务栏上
值为yes/no

17.singleInstance
Sets or retrieves a value that indicates whether only one instance of the specified HTML Application (HTA) can run at a time.
设置HTA能否以多窗口模式打开
值为yes/no

18.sysMenu
Sets or retrieves a Boolean value that indicates whether a system menu is displayed in the HTML Application (HTA).
设置是否显示系统的几个按钮,最大化,最小化
值为yes/no

19.version
Sets or retrieves the version number of the HTML Application (HTA).
设置HTA版本信息

20.windowState
Sets or retrieves the initial size of the HTA window.
设置HTA打开时的模式
值为normal/maximize/minimize

完整的HTA例子

<html>
<head>
<title>完整的HTA例子</title>
<HTA:Application
border="thick"
caption="yes"
maximizebutton="yes"
minimizebutton="yes"
sysmenu="yes"
windowstate="normal"
>
<style>
p {font-size:24;cursor:hand}
</style>
</head>
<body>
<p>Hello world!</p>
</body>
</html>

上一篇: 几个有意思的QQ字符画
下一篇: WAP(wml)开发问答
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
评论: 0 | 引用: 0 | 查看次数: 7047
发表评论
登录后再发表评论!