Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTA Applications Parsing HTML 1

Status
Not open for further replies.

minoad

Programmer
Mar 28, 2001
138
US
I am creating an HTA that will display the information from an html file and display it. I would like to display the raw html, but the HTA parses the data and shows the result.
Is thier an instruction or some way to make the hta not parse the data and just display the raw html without putting it into a text area?

Thanks
Micah A. Norman
 
How 'bout something like this (paste and try)? This sample just blobs the stuff inline - hopefully you have your HTML you want to display in some other form (say, retrieved using the Tabular Data Control or maybe via the FSO?).
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
Sub cmd1_onClick()
  divHTMLCode.innerText = _
    &quot;<HTML>&quot; & vbCrLf & _
    &quot;<HEAD>&quot; & vbCrLf & _
    &quot;</HEAD>&quot; & vbCrLf & _
    &quot;<BODY>&quot; & vbCrLf & _
    &quot;  <P align=center>&quot; & vbCrLf & _
    &quot;    <INPUT id=cmd1 type=button value=&quot; & _
      &quot;&quot;&quot;Show HTML&quot;&quot; name=cmd1>&quot; & vbCrLf & _
    &quot;  </P>&quot; & vbCrLf & _
    &quot;  <DIV id=divHTMLCode&quot; & vbCrLf & _
    &quot;    style=&quot;&quot;BACKGROUND-COLOR: lightsalmon;&quot; & _
      &quot; FONT-FAMILY: monospace&quot;&quot;>&quot; & vbCrLf & _
    &quot;    Before pressing the button...&quot; & vbCrLf & _
    &quot;  </DIV>&quot; & vbCrLf & _
    &quot;</BODY>&quot; & vbCrLf & _
    &quot;</HTML>&quot;
End Sub
</SCRIPT>
</HEAD>
<BODY>
  <P align=center>
    <INPUT id=cmd1 type=button value=&quot;Show HTML&quot; name=cmd1> 
  </P>
  <DIV id=divHTMLCode
    style=&quot;BACKGROUND-COLOR: lightsalmon; FONT-FAMILY: monospace&quot;>
    Before pressing the button...
  </DIV>
</BODY>
</HTML>
Sorry about all the line-wraps.
 
Thanks for the code. Im not entirely sure i see what is going on. By giving the divId it appears to be referencing the text within that? So, by appendoing a div to the beggingin of any file i write i should be able to do that. And one more quick question. The innertext property, what exactly does that do. The refrences im finding to that dont say anything about html. I am using FSO to view the file, but once i finish the subs and functions for this version, i am going to attempt to have the program do the same thing, but by grabbing live data off the internet without having to save it to the drive. This is probably the most complex program i have written so thanks for the push in the right direction. Been beeating my brain for a few days.

Thanks

Micah A. Norman
 
Sorry, I could have made it clearer by simply saying you should have your script code set the
Code:
innerText
property of a <DIV> to the stuff you want to display.

Actually it doesn't have to be a <DIV></DIV>, it could just as easily be a <P></P>!

Block objects like <DIV> and <P> have a bunch of useful properties, two of them being
Code:
innerText
and
Code:
innerHTML
. The first one inserts text, while the other inserts HTML - which will be interpreted as markup and displayed sort of like what you were getting and didn't want. Sometimes you DO want this, so it is available to let you insert &quot;fancy&quot; stuff into a block element.

What kind of moosh are you using for documentation? ;-)

You need DHTML reference materials, not HTML (a subset), so crack out those MSDN Library CDs/DVDs.

If'n you don't have those available (how the heck are you creating an HTA w/o the primary documentation?) just go to
You don't even have to register anymore (the last 2, 3 years?).
 
Well, this idea didnt start out as an hta, it began as a VB6 project. I recently got a job at a web development company were i am required to use a tool to create the site. The problem as with most auto generation tools is that it creates all kinds of garbage code. The program im working on will go into an html file saved on the hard drive and eliminate all of the garbage created by the tool. It will also create an XML outline of the website and allow editing of the webpage through that. Fact is the corp im working for is a bit stingy therefore im not going to be allowed to install any software to do this so im improvising by creating an HTA to do the same thing that i was haveing an exe doing. Tell you the truth it is one of the more enjoyable and challangeing projects ive worked on fir quite a while.
Thanks
Micah A. Norman
 
Glad to hear it.

I think most of us get all too few enjoyable and challenging projects.

VBScript is a great way to cobble up tools like the one you need. I think it brings something to the table that Unix hackers have always had, and that we've always needed on MS platforms.

By using the HTA model you get the best of VBScript, with a halfway-decent and easily programmed user interface to boot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top