Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Variables for ASP and VBScript

Status
Not open for further replies.

ktwclark

Programmer
Jan 30, 2002
54
GB
I'm just getting ot grips with ASP and VBscript, but since I use VB all the time it's fairly straight forward. However, I have an ASP page that has both ASP and vbscript code on it. What I need to do is use a value created in asp in my vbscript. Can I create a Global Variable that can be used by both. If not, is there another way?
 
yes
Session("count")=0
or
Application("count")=0

depending on if the var will only be session related for which to chose.

HOwever you really don't need to do this. The ASP variables can be used in the Vbscripting code. For instance
<SCRIPT language=&quot;VBscript&quot;>
<!--
sub validate_OnClick()
Dim SearchString, SearchChar, MyPos, Address
Address = <%Request.Form(&quot;email&quot;)%> provide tools to let people become their best.
 
yeah the trick is getting a client side variable to asp. :-(
 
Maybe this will help. All ASP code executes on the server. When the page is loaded to the client, ASP disappears and there is only client code.

To send information back to the server, you submit a form, i.e
<FORM METHOD=&quot;POST&quot; ACTION=&quot;MyPage.asp?ID=42&quot; NAME=&quot;sel&quot;>
...
</FORM>
or redirect
<A HREF=&quot;MyPage.asp?ID=42&quot;>Go Here</A>

Then on the new page you use
<%
ID = request(&quot;ID&quot;)
%>

Best of luck as an ASP programmer. Once you get the hang of the process, you are going to love it.
 
forecasting,

Were you serious with the last line &quot;Best of luck as an ASP programmer. Once you get the hang of the process, you are going to love it.&quot;?

Or was that sarcasm?

Just want to know what I'm in for ya know. Rob
Just my $.02.
 
I need to improve my writing style, I see. I was very serious. I started out in VB and switched into ASP.

Your question regarding transferring information from the client to the server and vice versa reminded me of my own struggle of coming to grips with processing on multiple machines. It is so straight forward. Yet, I struggled at first.

ASP rules. Applications written for solitary machines will go the way of vacuum tubes. My prediction, and I'm serious.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top