Why doesn't this work

From: Ray Hinse (rhinse_at_comcast.net)
Date: 03/28/04

  • Next message: Christoph Basedau: "Re: Question about the Sleep method"
    Date: Sun, 28 Mar 2004 23:38:04 GMT
    
    

    I have read that the srcipting engine used in most browsers, but especially
    IE, is the same engine used in WSH. If this is so, I would expect that most
    scripts either .vbs or .js could be run in a web browser with slight
    modifications. In keeping with this thought, I have slightly altered a portion
    of a .vbs script which tests a system and reports the version of WSH that is
    present. The code looks like this:

    WScript.Echo "WSH Version: " & WScript.Version

    Wscript.Echo "VBScript Version: " & ScriptEngineMajorVersion _
    & "." & ScriptEngineMinorVersion

    I have slightly altered this and placed it into a web page script like this:

    <input type="BUTTON" name="Exec1" value="Test this script" language="Jscript"
    onclick="doit1()">
    <script language="Jscript">
    function doit1() {
    document.write("WSH Version: " + WScript.Version + "<br><br>");
    document.write("VBScript Version: " + ScriptEngineMajorVersion + "." +
    ScriptEngineMinorVersion);
    }
    </script>

    I use JScript simply because I am used to using it for web page scripting, but the
    result
    would be the same if I used VBScript.

    The error message I get when I click the button is: 'WScript' is undefined

    Is this the result of using the code in a web page as opposed to calling WScript
    directly
    by using the .vbs suffix? Is there a way to make this work from a web page without
    calling the .vbs file with something like obj.Run?


  • Next message: Christoph Basedau: "Re: Question about the Sleep method"
  • Quantcast