Solved

Accessing javascript variable inside asp tags

Posted on 2004-04-27
5
396 Views
Last Modified: 2008-03-10
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
Comment
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
chaniewskim earned 20 total points
ID: 10927136
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
 
LVL 1

Expert Comment

by:i_rajeevsingh
ID: 10935763
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
 
LVL 1

Expert Comment

by:i_rajeevsingh
ID: 11341057
Please Close and distribute the points accordingly
0

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question