Mixing JScript and VBScript

Results 1 to 3 of 3

Thread: Mixing JScript and VBScript

  1. #1
    Join Date
    Dec 1969

    Default Mixing JScript and VBScript

    Within my JScript code I want to assign a value to one variable previously declared on a portion of VBScript code. How can I achieve that? <BR><BR>DValencia

  2. #2
    Join Date
    Dec 1969

    Default by getting on a time machine

    and going into the future 10 years.<BR><BR>Assuming you mean VBScript as ASP/Server Side, and assuming you mean JScript as client side, you cannot.<BR><BR>If that&#039;s not what you meant (which is what 99% of the people who ask this question mean -- if you&#039;re not, I apoligise), and both of these are on the same side (server OR client), then you should be able to pass it through without any difficult.

  3. #3
    Join Date
    Dec 1969

    Default right answer with minor caveat...

    ...and that is that *variables* are *NOT* interchangeable between the two languages. *ONLY* functions are. So you&#039;d need JS functions to set and get the variable&#039;s value that you then call from VBS:<BR><BR>&#060;SCRIPT Language=JavaScript RunAt=Server&#062;<BR>var whatever;<BR>function getIt( ) { return whatever; }<BR>function setIt( val ) { whatever = val; }<BR>&#060;/SCRIPT&#062;<BR><BR>&#060;%<BR>...<BR>&#039; to change the value of "whatever":<BR>Call setIt( 73.11 )<BR>&#039; to use the value of "whatever":<BR>x = 17 * getIt( )<BR>...<BR>%&#062;<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