可通过下拉框跳转到指定页
<script language=javascript>
function gopage()
{
documentlistpagesubmit();
}
function previouspage()
{
if ( (parseInt(documentlistpagepagevalue) ) < )
documentlistpagepagevalue = ;
else
{
documentlistpagepagevalue = parseInt(documentlistpagepagevalue) ;
documentlistpagesubmit();
}
}
function nextpage()
{
documentlistpagepagevalue = parseInt(documentlistpagepagevalue) + ;
documentlistpagesubmit();
}
function gopagebyno(pageno)
{
documentlistpagepagevalue = pageno;
documentlistpagesubmit();
}
</script>
<%
Connection m_Connection=null;
Statement m_Statement=null;
ResultSet m_ResultSet=null;
String sql;
String dbpath = applicationgetRealPath(/数据库位置); //将相对路径转化成物理路径
String connStr =jdbc:odbc:Driver={Microsoft Access Driver (*mdb)};DBQ=+dbpath;
ClassforName(sunjdbcodbcJdbcOdbcDriver);
m_Connection=DriverManagergetConnection(connStr);
m_Statement=m_ConnectioncreateStatement();
sql=查询语句;
m_ResultSet=m_StatementexecuteQuery(sql);
%>
<div>
<table class=list width= >
<%
int i=;
int rscount=;//记录条数
int allpages=;//所有页数
if(m_ResultSet!=null)
{m_ResultSetlast();
rscount=m_ResultSetgetRow();
if(rscount>)
{allpages=rscount / ;
if(rscount>(allpages * )){allpages=allpages+;}
if(curpage==){m_ResultSetfirst();}
else{m_ResultSetabsolute(*(curpage)+);}
while(!m_ResultSetisAfterLast())
{%>
<tr valign=top height=>
<td><%=m_ResultSetgetString(d_d_name)%></td>
<td><%=m_ResultSetgetString(d_t_name)%></td>
<td><input type=button name=Submit onClick=actiondo(del<%=m_ResultSetgetString(d_d_id)%><%=curpage%>) value=删除><input type=button name=Submit onClick=actiondo(edit<%=m_ResultSetgetString(d_d_id)%><%=curpage%>) value=编辑></td>
</tr>
<%
i++;
if(i>){break;}
m_ResultSetnext();
}
}
m_ResultSetclose();
}
%>
</table>
</div>
<div align=center>
<form name=listpage>
<font color=#> 页次:</font>
<b><font color=red><%=curpage%></font></b><font color=#>/<b><%=allpages%></b> </font>
<font color=#>
<% if (curpage!=)
{outprint(<a javascript:gopagebyno()>首页</a>);}
else
{outprint(首页);}
%>
</font>
<font color=#>
<%if(curpage!=)
{outprint(<a javascript:previouspage()>上页</a>);}
else
{outprint(上页);}
%>
</font>
<font color=#>
<% if(allpages!=&&(curpage<allpages))
{outprint(<a javascript:nextpage()>下页</a>);}
else
{outprint(下页);}
%>
</font>
<font color=#>
<% if(allpages!=&&(curpage<allpages))
{outprint(<a javascript:gopagebyno(+allpages+)>尾页</a>);}
else
{outprint(尾页);}
%>
</font>
<select name=page onChange=javascript:gopagebyno(documentlistpagepagevalue) >
<%for(i=;i<=allpages;i++)
{if(curpage==i){outprint(<option value=+i+ selected=selected>+i+</option>);}
else{outprint(<option value=+i+>+i+</option>);}
}
%>
</select>
</form>
</div>