Client-side VBScript won't execute

S

SLE

Hi there,

On the ASPX form, the user should enter his/her computername. I want this
TextBox to have a default value, determined from the local environment
variable %ComputerName%.

So I wrote the following VBScript function and put in in the <HEAD> section
and added <body onload="GetClientParameters">:

<script language="VBScript">
Sub GetClientParameters
Dim strName, wshShell

Set wshShell = CreateObject("WScript.Shell")
strName = WshShell.ExpandEnvironmentStrings("%ComputerName%")
document.InputForm.txtName.value = strName
End Sub
</script>

The above script works fine when launched as a VBS file, but returns an
error from IE: "ActiveX can't create object". I assume IE does not want to
execute the VBScript code for security reasons - is there another way?


Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top