Reputation: 7605
<body bgcolor="white">
<!--Add your controls here-->
<table cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td bgcolor="white">
<script type="text/vbscript">
document.write(userName)
window.Alert(userName)
</script>
</td>
<td bgcolor="white">row1_col2</td>
</tr>
<tr>
<td bgcolor="white">row2_col1</td>
<td bgcolor="white">row2_col2</td>
</tr>
<tr>
<td bgcolor="white">row3_col1</td>
<td bgcolor="white">row3_col2</td>
</tr>
</table>
<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>
The username only appears in the tags above the HTML. When I use window.Alert userName, the value does display but only if that code is in the section above. When I perform the same window.Alert in the body, I get "" (empty string).
I can't figure out whats going on. I updated the code as per the suggestions on one of the comments.
Upvotes: 0
Views: 450
Reputation: 200293
<% %>
is ASP syntax, not HTA syntax. In HTA you could use a nested <script>
tag, though:
<td><script type="text/vbscript">document.write userName</script></td>
BTW, I strongly recommend to use stylesheets for formatting tags (like setting the <td>
background color). It's much cleaner, and also much easier to maintain.
Upvotes: 1