View Full Version : Passing javascript variable to vbscript

12-12-2006, 10:31 AM
newbie in javascript just wanna ask if it is possible to pass javascript variable to vbscript? if possible pls do give me an example.

thanks in advance guys,

12-12-2006, 10:48 AM
You may be able to pass values between JScript and vbScript as they can both run in Internet Explorer, the one browser that offers those two languages instead of javascript. Should just be a matter of making them global variables and using the same name in JScript as in vbScript. You can't exchange data between Javascript and vbScript though because Internet Explorer doesn't run Javascript and other browsers don't run vbScript.

12-12-2006, 10:51 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>JS to VBScript</title>
<script type="text/vbscript" language="vbscript">
' Declare a VB variable
Dim intVariable_VB
intVariable_VB = 13

' VB Function
Function getVariable_VB(intAdd)
getVariable_VB = 7 + intAdd
End Function

<script type="text/javascript" language="javascript">
/* check if IE */
if(typeof window.ActiveXObject != "undefined") {
/* The VBScript variable */
var intVariable = intVariable_VB;

/* The result of the VBScript function */
var getVariable = getVariable_VB(3);

</html>Hope this helps