Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Variable between window - ASP - Please Help me

Status
Not open for further replies.

murugesanks

Programmer
Jan 25, 2001
48
US
I am passing a varible to Java Script function. While displaying(alert) it gives the value of the variable. But i need this value to be pass to next page. I need that variable in that new window page. How to pass it and how to get in the next page.

if i give like,

<script>
function openwin(x1)
{
alert(x1)
window.open(&quot;NewWindowPage.asp?x=x1&quot;)
}
</script>
<%
for i = 1 to 10
...
next
%>
<input type=&quot;button&quot; value=&quot;More Details&quot; name=&quot;B3&quot; onClick=&quot;javascript:eek:penwin(<% response.write i %>)&quot;>


Next Window Page Coding
-----------------------

<% Response.Write Request.QueryString(&quot;x&quot;) %>


I am getting result as x1 not the value of x1.




Please Help me,
Murugesan
 
I don't really see where you are getting your x1 from but your script should look somthing like this.

<script>
function openwin(x1)
{
alert(x1)
window.open(&quot;NewWindowPage.asp?x=<%=request(x1)%>&quot;)
}
</script>
 
Ok, now I think I see what you want to do.

So if the following code was in a file script.asp, it would generate the numbers on the server, pass the number associated with the button to the client script that opens the window passing the number to the server side code which reads the passed value and displays it in the page.

Hope this helps
-pete


<SCRIPT LANGUAGE=javascript>
<!--
function openWin( n){
var surl = &quot;script.asp?x=&quot; + n;
window.open(surl);
}
//-->
</SCRIPT>

<%
for(n=0; n<4; n++){
%>
<INPUT type=&quot;button&quot; value=&quot;Button<%=n%>&quot; id=button1 name=button1
onclick=&quot;openWin(<%=n%>)&quot;><br>
<%}%>

<b>You opened: <%=Request(&quot;x&quot;)%></b>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top