...

View Full Version : Passing javascript variable to vbscript



pbcatan
12-12-2006, 09: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,
paul

felgall
12-12-2006, 09: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.

martin_narg
12-12-2006, 09:51 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<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>

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

/* The result of the VBScript function */
var getVariable = getVariable_VB(3);
alert(getVariable);
}
</script>
</head>

<body>
</body>
</html>Hope this helps

m_n



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum