View Full Version : Passing variables
WPiersol
10-07-2005, 04:32 PM
I have a page that I retrieve info from my database. I want to set this to a variable. The variable will be use in a Javascript function. I am some knowledge with ASP and Javascript, but this in a new one to me. How can I pass the VBScript variable to a Javascript Function?
TheShaner
10-07-2005, 06:17 PM
Well, for example:
<% 'ASP does stuff with DB up here %>
<input type="button" onClick="exampleJS('<% =myASPvariable %>')">
Now this would insert myASPvariable's value there. You can remove the single quotes surrounding the ASP code if it's not a string of course. Just remember that ASP code is processed server-side, so the browser will only receive the resulting HTML and such that the ASP produces. JavaScript is client-side, so it won't be processed until after the ASP is processed. So just keep that in mind when working with the two.
-Shane
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.