title: Store VBScript variable in hta html tag
body: <p><del>This is more of an informational post, rather than a question. But I'll leave an open ended question; if you can improve on the idea please share.</del> ~EDIT</p>
  
  <p>Is there a better way to store a variable in an HTA? I have come up with this method and it works, but I'm not sure if it's the best way to do this;</p>
  
  <p>Preface: I'm new to coding.</p>
  
  <p>I have been working on a GUI (wrapped in HTA) that is underpinned by VBScript. I was looking for a way to dynamically store variables that I could easily call in other subs/functions independently. This is what I came up with;</p>
  
  <p>psuedo code:</p>
  
  <pre><code>Function StoreVar()
      If somecondition = "someexpectation" Then
        source.InnerHTML = "&lt;a name='myVar' value='var1'&gt;&lt;/a&gt;"
      Else 
        source.InnerHTML = "&lt;a name='myVar' value='var2'&gt;&lt;/a&gt;"
      End If
  End Function
  </code></pre>
  
  <p>The markup;</p>
  
  <pre><code>&lt;div id="source"&gt;&lt;/div&gt;
  &lt;input type="button" name="Show Variable" onclick="CallVar()" /&gt;
  </code></pre>
  
  <p>Calling the stored variable;</p>
  
  <pre><code>Function CallVar()
     MsgBox myVar.value
  End Function
  </code></pre>
  
  <p>Fairly straight forward, but uses a little trickery since you never see the actual variable being stored since the div that it is going into does not appear in the GUI. The only affect that it may have on the GUI is the actual placement of the div in the html. I usually put these div's at the end of my html body.</p>
  
  <p>Anyways, I just officially joined. I've been using this site since I started coding (not too long), but I figured that I would start contributing.</p>