Passing variables from Javascript to ASP

C

Consuelo Guenther

Hello,
I am having problems with passing variables between pages. I have the
following:
First asp page has the function:
-----------------------------------------------------------------------
<script language="JavaScript">
function addProcess(addPName,addSProcess,addPIndex)
{
var addProcessWindow =
window.open('second.asp','mywindow','width=400,height=200');
addProcessWindow.focus();
return(true);
}
</script>
--------------------------------------------------------------------------------------------
There is button (not in a form) that is clicked and calls the function above.
The variables addPName,addSProcess, and addPIndex are the variables I need
to pass and be able to reference on to the page 'second.asp'.
For now, all I am trying to do is to verify if the values are being passed
to my 'second.asp' page. How can I retrieve the values in the page
below?--------------------------------------------------------------------------------------------
<%@ LANGUAGE="JScript" %>
<html>
<head>
<title>Second</title>
<%
Response.Write ???? -> variables here...
%>
</head>
<body>
</body>
</html>
 
R

Ray Costanzo [MVP]

Pass them in the querystring. Example:

yourpage.asp:
<html>
<head>
<script language="JavaScript">
function addProcess(addPName,addSProcess,addPIndex)
{

var addProcessWindow = window.open('second.asp?a='+addPName + '&b=' +
addSProcess + '&c=' + addPIndex,'mywindow','width=400,height=200');
addProcessWindow.focus();
return(true);
}
</script>
</head>
<body>
<button onclick="addProcess('Hi ','there ','Consuelo');">Click me</button>
</body>
</html>


second.asp:
<%
Response.Write Request.Querystring("a") & Request.Querystring("b") &
Request.Querystring("c")
%>


Note that you don't have to use "a," "b," and "c." You can do
'second.asp?whateveryoulike=' + addPName....

Ray at home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top