Solved

Accessing javascript variable inside asp tags

Posted on 2004-04-27
5
393 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
Comment Utility
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
Comment Utility
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
Comment Utility
Please Close and distribute the points accordingly
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now