A Javascript method:
<html>
<head>
<script>
function jumpto(whatform, querykey) {
//get the url querystring
var url = window.location.search;
//the replace query
var queryrx = new RegExp("([?&])" + querykey + "=[^\&]+(?=&|$)", "gi");
//which item selected in dropdown
var index=whatform.pageselect.selectedIndex;
//if the first option, ignore it since it is blank
if (whatform.pageselect.options[index].value != "0") {
//is a query string available
if (url.length>0) {
//our query key is present
if (queryrx.test(url)) {
//now we replace the querystring from old to new
url = url.replace(queryrx, '$1' + querykey + '='+whatform.pageselect.options[index].value);
//clear out the question mark from the querystring
url = url.replace("?", '');
//our query key is not present, but there is querystring data
}else{
url = url.replace("?", '');
url = querykey + "=" + whatform.pageselect.options[index].value + "&" + url;
}
//no querystring data exists
}else{
url = querykey + "=" + whatform.pageselect.options[index].value;
}
//alert(url);
//this is the url we are getting bounced to
location = "mypage.asp?"+url;
}
}
</script>
</head>
<body>
<FORM NAME="form1">
<SELECT NAME="pageselect" ONCHANGE="jumpto(this.form, 'thequerykey')" SIZE="1">
<OPTION VALUE="">Choose a Page</OPTION>
<OPTION VALUE="pageA">First Page</OPTION>
<OPTION VALUE="pageB">Second Page</OPTION>
</SELECT>
</FORM>
</body>
</html>
If you want to go with an ASP Classic solution, you will need to use a function to clear your old value from your querystring
https://stackoverflow.com/a/1221672/2004151
And then print your querystrings as Hidden Input fields in your form (MyFunctionResultsExceptPageSelect below).
Something like:
<FORM ACTION="mypage.asp" METHOD="GET" NAME="form3">
<%=MyFunctionResultsExceptPageSelect("pageselect")%>
<SELECT NAME="pageselect" ONCHANGE="document.form3.submit()" SIZE="1">
<OPTION VALUE="">Choose a Page</OPTION>
<OPTION VALUE="pageA">First Page</OPTION>
<OPTION VALUE="pageB">Second Page</OPTION>
</SELECT>
</FORM>
<%
Function MyFunctionResultsExceptPageSelect(key)
Dim qs, x
For Each x In Request.QueryString
If x <> key Then
qs = qs & "<input type=""hidden"" name="""&x&""" value="""&Request.QueryString(x)&""" />"
End If
Next
MyFunctionResultsExceptPageSelect = qs
End Function
%>
If you want to get the current page instead of manually specifying it, then use the following.
In javascript snippet, use the answer here:
https://stackoverflow.com/a/5817566/2004151
And in ASP, something like this:
http://classicasp.aspfaq.com/files/directories-fso/how-do-i-get-the-name-of-the-current-url/page.html