In JavaScript I can do something like:
document.getElementByID("tally").innerHTML = HTMLOutput
and it will put the HTML variable in the
<span id = "tally"></span>
part.
Is there a way to do this using VBScript?
Thanks.
That is all part of the browser's DOM and works with either language,
though VBS is only supported in IE.
Why do you ask? Are you having a specific problem?
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
Well, I am getting an error:
Microsoft VBScript runtime error '800a01a8'
Object required: 'window'
/page.asp, line 539
and the line is:
window.document.getElementById("tally").innerHTML = HTMLOutput
Thanks.
Yes. Note that you originally posted ...
document.getElementById("tally").innerHTML = HTMLOutput
and I said that should work in IE, regardless of the language
selected.
Now you are posting ...
window.document.getElementById("tally").innerHTML = HTMLOutput
with an error that the object window is required. That's because
everything in an HTML/ASP page is presumed to be part of the windows
class/object, as I understand the DOM. Therefore, you are really
trying to reference a window object in the window class. Drop the
window reference and it should work.
Ahhh yes that would make sense. My ASP page does some prints
responses to a survey throughout the page, and does some tallies
throughout, then I want to print some HTML with the result of the
tallies back at the top of the page.
<html>
<head>
<hta:application id = "dynspan" />
<title>dynspan</title>
<meta http-equiv = "content-script-type" content = "text/vbscript"/>
<script language = "VBScript" type = "text/vbscript">
'<![CDATA[
''= write to span "tally"
' ============================================================================
Sub doIt()
' document.getElementById("tally").innerHTML = "HTML<b>Output</b>"
window.document.getElementById("tally").innerHTML = "HTML<b>Output</b>"
End Sub
''= refreshes the HTA page, which includes re-running any Windows_Onload code
' ============================================================================
Sub reloadHTA()
location.reload True
End Sub
']]>
</script>
</head>
<body>
<span id = "tally">will be replaced</span>
<hr />
<input type = "BUTTON" value = "write to tally" onclick = "doIt">
<hr />
<input type = "BUTTON" value = "reload" onclick = "reloadHTA">
</body>
</html>
there is no problem in *client side* script to access the window object.
I stand corrected.