JScript to VBScript

Results 1 to 2 of 2

Thread: JScript to VBScript

  1. #1
    Join Date
    Dec 1969

    Default JScript to VBScript

    I am trying to get the value of a form field from the opening document via Jscript, then move it to VBScript and eventually use the value in a query (I am printing the value in the code below). <BR><BR>---------------------------------------------------- <BR>&#060;% @language=&#039;VBScript&#039; %&#062; <BR><BR>&#060;script language=&#039;Javascript&#039; runat=&#039;server&#039;&#062; <BR>function createResult() <BR>{ <BR>var returnResult = window.opener.document.forms[0].CFRNon.value; <BR>return(returnResult); <BR>} <BR><BR>function cResult() <BR>{ <BR>this.create = createResult; <BR>} <BR><BR>function Result() <BR>{ <BR>var obj = new cResult; <BR>return(obj); <BR>obj = null; <BR>} <BR>&#060;/script&#062; <BR><BR>&#060;% <BR>Dim objResult <BR>Set objResult = Result() <BR><BR>Response.write("The result is " & objResult.create()) <BR>%&#062; <BR><BR>---------------------------------------------------- <BR><BR>When running the code I get the following error code: <BR><BR>Microsoft JScript runtime error &#039;800a1391&#039; <BR>&#039;window&#039; is undefined <BR>jscriptobj.asp, line 6 <BR><BR>Any suggestions? <BR>

  2. #2
    Join Date
    Dec 1969

    Default Sigh...client vs. server, again...

    You can NOT use client side objects in server side code.<BR><BR>Period period period.<BR><BR>document and *all* its subordinate elements and objects are *only* accessible in the browser, not in "runat=server" code.<BR><BR>Period period period.<BR><BR>Back to the basics, I&#039;m afraid. Look in the ASPFAQs to see how you "transfer" browser-side values to ASP code (of any flavor).<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts