一種很好的分頁方法,刪除資料的方式(帶確實和取消視窗),搜尋索引鍵(含空格)的處理

來源:互聯網
上載者:User
分頁|關鍵字|資料 <!-- #include file="connect.asp" -->
<%
Keyword=request("Keyword")
Keyword=replace(Keyword," ","")

page = Request.QueryString("page")

sql="select * from 試卷資訊 where 試卷名稱 like '%"&keyword&"%'"
rs.open sql,conn,1,1

dim page,maxPerPage
maxPerPage=2 '每頁顯示的記錄數
rs.pagesize=MaxPerPage
if (page="" or isempty(page)) then page=1
thisUrl="2.asp?Keyword="&Keyword
session("adminOldUrl")=thisUrl&"&page="&page
%>

<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function jumpTo(i){
if(i==1){
this.document.location="<%=thisUrl%>";}
if(i==2){
this.document.location="<%=thisUrl%>&page=<%=page-1%>";}
if(i==3){
this.document.location="<%=thisUrl%>&page=<%=page+1%>";}
if(i==4){
this.document.location="<%=thisUrl%>&page=<%=rs.pageCount%>";}
}
// -->
</script>

<form method="post" action="2.asp">
<input type="text" name="keyword" size=57 value="" maxlength="50" style="width: 390; height: 20">  
<input type="submit" name="Sub" value=" 查 詢 "></td></form>

<%
if not (rs.eof or err) then rs.move (page-1)*maxPerPage
do while i < maxPerPage And not rs.eof %>

<% =rs("試卷名稱")%> <a href="2.asp?mode=del&page=<% =page%>">刪 除</a><br>

<% n=n+1
if n>=maxPerPage then exit do
rs.movenext
loop
%>

<div align="right"><font color=#FFFFFF>共<b><%=rs.recordCount%></b>項 第<b><%=page%>/<%=rs.pageCount%></b>頁 </font>
<%if page>1 then%>
<input type="button" name="Submit3" value="首頁" onClick="Javascript:jumpTo(1)">
<input type="submit" name="Submit4" value="上頁" onClick="Javascript:jumpTo(2)">
<%else%>
<input type="button" name="Submit3" value="首頁" disabled>
<input type="submit" name="Submit4" value="上頁" disabled>
<%end if
if rs.recordCount>page*maxPerPage then%>
<input type="submit" name="Submit5" value="下頁" onClick="Javascript:jumpTo(3)">
<input type="submit" name="Submit6" value="末頁" onClick="Javascript:jumpTo(4)">
<%else%>
<input type="submit" name="Submit5" value="下頁" disabled>
<input type="submit" name="Submit6" value="末頁" disabled>
<%end if%>
</div>

<%
if request("mode")="del" then
id=request("id")
page=request("page")
%>
<script language="javascript">
<!--
temp=window.confirm("不能恢複!您確實要刪除此記錄?");
if (temp)
{
window.location.href="del.asp?page=<% =page%>&Date=<% =date()%>"
}
else
{
history.back();
}
//-->
</SCRIPT>
<%end if%>




相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.