|
|
 |
| ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP Pro Code Clinic section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|

June 4th, 2003, 03:27 PM
|
|
Registered User
|
|
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
use vbscript declared variable in asp
Hi i need to use a variable declared under the <script> tag later in my asp page. Code follows:
<%@LANGUAGE=VBSCRIPT%>
<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</head>
<script language=vbscript>
dim myvar
myvar = "hello"
</script>
<body>
<br>
<%
response.write (myvar)
%>
</body>
</HTML>
how do i use the myvar variable declared under the <script> tag under the asp <% %> tags. Thanks George
|

June 4th, 2003, 07:34 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The code in the script tag is running on the *client*. The code running between the <%%> (asp) is running on the *server*. You can't just transfer the variables like that. To send the value to the server you must either:
- Create a form, add the value to one of the fields on the form and POST the form
- Add it to a querystring (GET) and make a new request to the server.
There are other options but these are the most straightforward. I can provide further details.
regards
David Cameron
|

June 5th, 2003, 07:39 AM
|
|
Registered User
|
|
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the reply david, I know how to use the two solutions you suggested I was hoping for something else please let me know of any other solutions that may work. (any language) I'm leaning towards creating a session variable then calling its value whenever i need it. Thanks George
|

June 5th, 2003, 07:33 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You can't avoid a trip to the server and sending the variable (either by GET or POST) is the most convenient way to do this.
regards
David Cameron
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |