Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 403
  • Last Modified:

Accessing javascript variable inside asp tags

Is there anyway to access the Javascript variable inside ASP or HTML?
i ve one variable inside javascript that variable's value i want to display inside ASP tags?
can it be done?


raja
0
KrishnamoorthyRajagopal
Asked:
KrishnamoorthyRajagopal
  • 2
1 Solution
 
chaniewskimCommented:
No easy way.
JS is client-side, ASP is server-side. You can only pass data from client-side to server-side using QueryString or Form collecion, which implies refreshing a page. For example you could create a link:

<a href=# onclick="location.href='mypage.asp?myvariable=' + myVariable;">xxx</a>

then use Request("myvariable") to retrieve argument
0
 
i_rajeevsinghCommented:
Sure
No way

You can use query string and submit to fetch data from fields
and for the variables you can store them in Hidden Fields and get at the server

Moreover youcan assign value to Client Side Variable through the Server Side Scripting
Like in ASP
It is like

<%my_text="Hello"%>
<script langugae="Javascript">
function test
{
str=<%=my_text%>;
alert(str);
}
</script>

Regards
Rajeev
0
 
i_rajeevsinghCommented:
Please Close and distribute the points accordingly
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now