加载时的VBScript设置值 [英] VBScript set value at onload
问题描述
我有一个带有VBScript的HTA,它的元素设置为变量SN2:
I have an HTA with VBScript that has an element set to a variable, SN2:
<script language="VBScript">document.getElementById("ComputerName").value = SN2</script>
设置为打印到HTML文本框:
Set to print out to an HTML textbox:
<html><input class="inputs" type=text id="ComputerName" name=ComputerName /></html>
这很好用!但是,我想设置要在onload
And this works well! However, I wanted to set the value to display in the textbox on onload
为此,我将VBScript函数设置为<body onload="myFunction()">
.效果很好,除了我需要将另一个功能设置为body onload
To do this, I set my VBScript function to <body onload="myFunction()">
. And this works well, except there is another function I need to set to body onload
所以我想知道是否有一种方法可以将我的document.getElementById("ComputerName").value = SN2
设置为以另一种方式加载.
So I was wondering if there was a way to set my document.getElementById("ComputerName").value = SN2
to onload in a different way.
我知道使用javascript的方式,就像可以设置document.getElementById("ComputerName").onload
一样,但这在VBScript中似乎不起作用.可以在VBScript中完成吗?如果可以,如何做?我不能为我的情况使用javascript.我指的是此方法(尽管我不需要他们在此示例中拥有的所有iframe内容).由于某种原因,这种JS方式无法在VBScript中翻译.
I know the way in javascript, like you can set document.getElementById("ComputerName").onload
, but that doesn't seem to be working in VBScript. Can this be done in VBScript, and if so, how? I can't use javascript for my case. I'm referring specifically to this method (although I don't need any of that iframe stuff they have in this example). For some reason this JS way doesn't translate in VBScript.
感谢您的任何输入!
推荐答案
您可以在加载时调用许多函数:
You can call many functions onload:
<BODY onLoad="firstFunction();secondFunction() ">
这篇关于加载时的VBScript设置值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!