how to get javascript variable value into asp variable

T

tnhoe

Hi,

if I have both javascript and aspscript,

how to get/retrieve the variable value in javascript into asp variable ?

regards
hoe
 
A

Alvaro G Vicario

*** tnhoe wrote/escribió (Mon, 28 Mar 2005 12:19:23 +0800):
if I have both javascript and aspscript,

What is aspscript?

how to get/retrieve the variable value in javascript into asp variable ?

If you mean client-side JavaScript, you have these options:

* Cookies (not 100% reliable)
* GET
* POST
 
T

Tim Slattery

tnhoe said:
Hi,

if I have both javascript and aspscript,

how to get/retrieve the variable value in javascript into asp variable ?

The Javascript is (presumably) running on the client *after* the ASP
code has run on the server and created the page. So, by the time the
Javascript variable is created, the ASP code has finished and no
longer exists.

Tell us what you're trying to do, maybe we can suggest something.
 
K

kaeli

[email protected] enlightened us said:
Hi,

if I have both javascript and aspscript,

how to get/retrieve the variable value in javascript into asp variable ?

Clarify what you mean.
There is no such thing as aspscript.

ASP[.net] is a framework.
It can run javascript (jscript), vbscript, and other languages on the SERVER
SIDE.
MSIE can use vbscript or javascript on the CLIENT-side.
All other browsers can use javascript on the CLIENT-side.

So, are you trying to share variables all on the client, all on the server,
from the server to the client, or from the client to the server?

You can easily write values from the server to the client.
To get stuff from the client to the server in an ASP.net environment, use
postback. Any other environment (including classic ASP), you have to
specifically make a request to the server as either a form submission, get
params (url) or other means (img tag that calls script, etc).

--
--
~kaeli~
"When dogma enters the brain, all intellectual activity
ceases" -- Robert Anton Wilson
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
A

aqualizard

how to get/retrieve the variable value in javascript into
asp variable ?

Well, as others have said, this doesn't make sense. But to pass a
variable to ASP you use a form with get or post, or a URL that fakes a
get (like onClick="location=./submit.asp?clr=yellow&size=xlarge").

In ASP, for a post use Request.Form("clr"), for get use
Request.QueryString("size"), in the case of my code from above.

To put ASP into HTML or Javascript, just use <%= VariableName %>, so in
Javascript you could have

var TheColor = '<%= ColorVal %>'

Hope this helps,
A.L.
If I were you I would go to an ASP site, like
http://www.4guysfromrolla.com for basic concepts like this...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top