VBScript set value at onload

I have an HTA with VBScript that has an element set to a variable, SN2:

<script language="VBScript">document.getElementById("ComputerName").value = SN2</script>

Set to print out to an HTML textbox:

<html><input class="inputs" type=text id="ComputerName" name=ComputerName /></html>

And this works well! However, I wanted to set the value to display in the textbox on 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

So I was wondering if there was a way to set my document.getElementById("ComputerName").value = SN2 to onload in a different way.

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.

Thanks for any input!



You can call many functions onload:

<BODY onLoad="firstFunction();secondFunction() ">


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.