Solved

Accessing javascript variable inside asp tags

Posted on 2004-04-27
5
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
Suggested Courses

617 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