Tips for building a decent HTA/HTML application
Tinniam V Ganesh 270004Y158 Visits (11345)
This post includes some basic tips to consider while building a HTA/HTML application. Clearly I am no Web guru knowledgeable of the various technologies that make the Web zip and zing. Here are my 2 cents
Any HTML page will contain tags for e.g <head> </head> <body> </body> <p. </p> etc.
Any self-respecting Web page will include a vertical or a horizontal menu. For this you would need to use a Cascade Style Sheet (CSS). Rather than re-inventing the wheel do re-use the cool menu items & CSS style sheets at the following site
You will also be adding textboxes, radio buttons, submit and reset buttons. Assuming you have all the form controls in a single form you need to use the following
Consider a form
<form method="post" name="form1">
<p>Enter the file name containing the server list (srvr_list.txt) :<input name="servers" type="file" onbl
For this to get the input from the text box use
file = form1.servers.value
Using a radio button is a little tricky. Radio buttons belong to a group and the way to handle this in VBscript is as follows
<fieldset name="Group1" style="width: 167px; height: 54px">
<input name="Radio1" type="radio" value="Yes" /> Yes&
<input checked="checked" name="Radio1" type="radio" value="No" />No</fieldset>
This is done by iterating through the radio button list
for each radio in form1.Radio1
If radio.checked = true Then
If radio.value = "Yes" then
ElseIf radio.value = "No" Then
Handling a Submit requires that you handle the onClick action as below
<input name="Submit1" type="submit" value="submit" onCl
This indicates that when you click the Submit button you will invoke the subroutine fileSize
A Reset button is of type “reset”. As long as you enclose all the controls in a single form hitting the reset button will clear all the controls.
Populating output in a table: To populate output dynamically in a table I used MS Tabular Data Control (TDC) when the output is written to a CSV file. The cool thing about this is that it automatically paginates output and display “n” entries per page instantaneously. I had tried various thing like populating using DOM, InnerHTML but all of those failed miserably when the o/p was very large. With TDC I can display ~30K entries instantaneously from a CSV file.
This is done as below
The CLASSID is the TDC control. Make sure you choose the correct delimiters and text qualifiers. Populate your CSV file.
You then need to connect this with Datasrc as below
<TABLE id="tblData" DATASRC="#data2" BORDER="2" datapagesize="20">
<th>Last Write Time</th>
Add cool first,previous,next and last buttons as follows
<input type="button" value=' |<< ' oncl
<input type="button" value=' < ' oncl
<input type="button" value=' > ' oncl
<input type="button" value=' >>| ' oncl
Finally in your sub routine which you invoke to populate the table make sure you rebind your table with the new data as below
data2.DataURL = ""
data2.DataURL = "c:\\files.csv"
This is shown below
From my blog: