-
Passing variables
Hello,
I have this code and what I'm trying to do is send a variable from my hyperlink code to
the OpenWindow function. I'll then send this variable using querystrings to another ASP
page where I'll then use it.
1.)
Code:
<a href="javascript:OpenWindow('testing123');">Test sending var</a>
2.)
Code:
<script language="JavaScript">
<!--
function OpenWindow(myVar)
{ window.open("specials.asp?yourVar=myVar","NewWindow","width=400,height=400,noresize,scrollbars=yes,toolbar=0,menubar=0");
}
// end popup windows -->
</script>
3.)
In specials.asp I'll then do this, and hopefully var = "testing123"
Code:
<%
dim var
var = request.querystring(yourvar)
%>
Thanks,
T
-
I presume it doesn't work then!
Try this ( I haven't tested it)
Code:
<HTML>
<script language="JavaScript">
<!--
function OpenWindow(myVar)
{
var url = "specials.asp?yourVar=" + myVar
window.open(url,"NewWindow","width=400,height=400,noresize,scrollbars=yes,toolbar=0,menubar=0");
}
// end popup windows -->
</script>
<BODY>
<a href="javascript:OpenWindow('testing123');">Test sending var</a>
</BODY>
</HTML>
Code:
<%
dim var
var = request("yourvar")
%>
-
I've no idea why it's put a space in "javascript". It's not there if I edit it:confused:
-
Hi Mark,
Thank you very much!! Your code works 100%.
T