Posted by : Sudhir Chekuri Wednesday, 2 October 2013

HTA stands for HTML Application.
HTML is used for create static webpages and this HTA is used to create applications using HTML in it.
Scripting and css can be used in HTA application ie., everything used in html can be used in hta files.
<HTA:Application> tag is used to mention document related properties like border. caption,.. and this tag is recommended to write in head tag.
Title tag is used to mention the title which is dispayed on the top of the window.
In the below example code Window_OnLoad is the vbscript sub routine used to define some properties of the document which are assigned when the window is loaded.
All the properties that are mentioned in <HTA:Application> can be assigned in Window_OnLoad through scripting.
We can write script methods which can be called using html events like click for button.


Steps to create HTA file

Create a notepad .txt document write the below sample HTA code in it and save it with .hta extension.

HTA example code with password textbox in a window that displays at the center of screen


<html>
<head>
  <HTA:APPLICATION 
border="thin" 
borderStyle="normal" 
caption="yes" 
maximizeButton="yes" 
minimizeButton="yes" 
showInTaskbar="no" 
innerBorder="yes"
navigable="yes"
scroll="auto"
scrollFlat="ye
     /> 
<title>HTA application window</title>
</head>
<script language="VBScript">
Sub Window_OnLoad
     window.resizeTo 350,150
    window.moveTo (screen.width - document.body.clientwidth)/2, ((screen.height - document.body.clientheight)/2)-100
    
End Sub
    </script>

<body>
<div align="center">
Enter Password : <input type="password" id="Pass" size="35">
<INPUT TYPE="button" VALUE="OK" name="run_button" >
<br><br>
</div>
</form>
</body>

</html>

The above code displays a window with width 350 and height 150 at the center of screen with a password textbox.


Leave a Reply

Subscribe to Posts | Subscribe to Comments

Followers

Total Pageviews

Powered by Blogger.

Blog Archive

- Copyright © 2013 DevStudent - Metrominimalist - Powered by Blogger - Designed by Johanes Djogan -