Neil Thompson
asked on
iterate through passed URL params
Hi
I have the following code which works if I pass a querystring such as mypage.asp?a=hi&b=test&c=t hree&d=fis t etc....
I want to be able to just pass a set of parameters to the page such as mypage.asp?hi,test,three,f ist and let it just deal with however many are sent, how can I achieve this please
I then ned to pass these to the window operner function which for some reason needs everything with ' around otherwise I get obj1 is null errors
Regards
Neil
I have the following code which works if I pass a querystring such as mypage.asp?a=hi&b=test&c=t
I want to be able to just pass a set of parameters to the page such as mypage.asp?hi,test,three,f
I then ned to pass these to the window operner function which for some reason needs everything with ' around otherwise I get obj1 is null errors
Regards
Neil
<html>
<head>
<title></title>
<script language="javascript">
function passBackArgs() {
a = '<% =Request.QueryString("a") %>';
b = '<% =Request.QueryString("b") %>';
c = '<% =Request.QueryString("c") %>';
d = '<% =Request.QueryString("d") %>';
e = '<% =Request.QueryString("e") %>';
f = '<% =Request.QueryString("f") %>';
try {
window.opener.jspassback(a,b,c,d,e,f);
self.close();
} catch(e) {
alert(e);
//alert("Parent Window is Closed!");
}
}
</script>
</head>
<body onload="javascript: passBackArgs();"></body>
</html>
You can't just pass values in a url. The there has to be a name-value pair. That's the only way it works.
I have had success in passing values like this:
"page.asp?vals=a,b,c,d,e,f ,g,h"
You can get your values string from the Request.QueryString and then dump your data into an array after slippting based on the comma.
Then, you just cound how many elements you have in your array and you should be set.
"page.asp?vals=a,b,c,d,e,f
You can get your values string from the Request.QueryString and then dump your data into an array after slippting based on the comma.
Then, you just cound how many elements you have in your array and you should be set.
ASKER
Thanks dimmergeek that sounds like what im after but how would I achieve that?
I'm not too up with asp any more.
I'm not too up with asp any more.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can't just pass values in a url. The there has to be a name-value pair. That's the only way it works.Actually, that is not true. You can get it from the Request.ServerVariables() Collection. Try:
Dim data
data=Split(Request.ServerVariables("QUERY_STRING"), ",")
For i=0 To UBound(data)
Response.Write data(i) & "<br >"
Next
ASKER
just what I needed, many thanks
Neil
Neil
You're welcome. Thanks for the points!
Thank you for the points!