制作了一分页程序,可以从下拉式列表中选择到达页面,用onchange触发PageCurrent(),将URL修改为“当前URL+page=到达页”达到目的,用GetUrl()函数取得当前URL,如何将当前URL传递给PageCurrent()??用onchange=PageCurrent(GetUrl()) 不行,请高手解决,程序如下:
<%
'获取当前Url参数的函数
Private Function GetUrl()
Dim ScriptAddress, M_ItemUrl, M_item
ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) '取得当前地址
M_ItemUrl = ""
If (Request.QueryString <> "") Then
ScriptAddress = ScriptAddress & "?"
For Each M_item In Request.QueryString
If InStr(page,M_Item)=0 Then
M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(Request.QueryString(""&M_Item&"")) & "&"
End If
Next
end if
GetUrl = ScriptAddress & M_ItemUrl
End Function
%>
<script language=javascript>
//选择"第?页"时响应:
function PageCurrent(url)
{ //data_list.asp是本程序的文件名
document.form1.action=url+'Page='+(document.form1.CurrentPage.selectedIndex+1)
document.form1.submit();
}
</Script>
<%
'下拉式列表,用于选择跳页
Response.Write("第<select size=1 name=CurrentPage onchange=PageCurrent(GetUrl()) class='input1'>")
For c=1 to rs.PageCount
if ipage=c then 'ipage为当前页值
Response.Write("<option selected>"&c&"</option>") '当前页码
else
Response.Write("<option>"&c&"</option>")
end if
Next
Response.Write("</select>页 ")