Forum Moderators: open
The main part of the page is traditional VB script. however I need to use some JScript on the page. It took me ages to work out but I finally realised I needed to add <script language=JavaScript runat=server> to get it to work and that bit is working fine now.
However I need to pass a varible from my VBScript to the JScript bit.
Ie from a earlier database call I have:
widgetuid = Rs("fld_widget_uid")
Now I need to use this in the JScript code ie:
var currentRestId = widgetuid;
Something like:
<%
widgetuid = Rs("fld_widget_uid")
Call MyJScriptFunction(widgetuid)
%>
<SCRIPT LANGUAGE="JavaScript" runat="server">
function MyJScriptFunction(currentRestId){
//etc
}
</SCRIPT>
var currentRestId = widgetuid;
because the widgetuid is now in the currentRestId variable.
So now just do your JS processing on that variable in the JS function. You can also return a value back from JS to your VB code - just treat any JS function as a normal VB function.