469,307 Members | 2,082 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,307 developers. It's quick & easy.

Passing variables from Javascript to ASP

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,hei ght=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>
----------------------------------------------------------------------------------------------
Please help!
Thanks. :-)

Jul 19 '05 #1
1 3326
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


"Consuelo Guenther" <Co**************@discussions.microsoft.com> wrote in
message news:CA**********************************@microsof t.com...
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,hei ght=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>
----------------------------------------------------------------------------------------------
Please help!
Thanks. :-)

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by domeceo | last post: by
9 posts views Thread by Max | last post: by
3 posts views Thread by q-rious | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.