By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,628 Members | 1,723 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,628 IT Pros & Developers. It's quick & easy.

how to get javascript variable value into asp variable

P: n/a
Hi,

if I have both javascript and aspscript,

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

regards
hoe
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
*** 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
--
-- Álvaro G. Vicario - Burgos, Spain
-- Don't e-mail me your questions, post them to the group
--
Jul 23 '05 #2

P: n/a
In article <42**********@news.tm.net.my>, tn***@pc.jaring.my enlightened us
with...
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

Jul 23 '05 #3

P: n/a
"tnhoe" <tn***@pc.jaring.my> wrote:
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.

--
Tim Slattery
Sl********@bls.gov
Jul 23 '05 #4

P: n/a
>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...

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.