ekkehard
Wed Nov 28 12:00:38 PST 2007
Tom Lavedas schrieb:
> On Nov 28, 1:30 pm, KDawg44 <KDaw...@gmail.com> wrote:
>> On Nov 28, 12:59 pm, Tom Lavedas <tglba...@cox.net> wrote:
>>
>>
>>
>>> On Nov 28, 12:48 pm, KDawg44 <KDaw...@gmail.com> wrote:
>>>> Hi,
>>>> 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.
>
> Tom Lavedas
> ===========
>
http://members.cox.net/tglbatch/wsh/
>
As can be seen from:
<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.