<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>脑筋急转弯,便民查询网</title>
<link href="/Skins/Style_1.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!-- 
td           { font-size: 12px; line-height: 17px }
body         { font-size: 12px; line-height: 17px }
p            { margin-top: 1px; margin-bottom: 1px }
a:link       { text-decoration: none; color: black }
a:visited    { text-decoration: none; color: black }
a:active     { text-decoration: none }
a:hover      { text-decoration: underline; color: red }
body,p,td    { font-family:Verdana, Arial, Helvetica, sans-serif; }
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
//-->
</script>
</head>

<body background="images/bg.gif">
<!--#include virtual="/Inc/Head.asp" -->
<div align="center">
  <center>
  <table border="1" width="761" bordercolorlight="#3399FF" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF">
    <tr>
      <td width="757" height="25" bgcolor="#FFFFFF" align="center" colspan="3">　</td>
    </tr>
    <tr>
      <td width="58" height="25" bgcolor="#FFFFFF" align="center">编号</td>
      <td width="539" height="25" bgcolor="#FFFFFF" align="center">脑筋急转弯题目</td>
      <td width="156" height="25" bgcolor="#FFFFFF" align="center">查看</td>
    </tr>
<%              
sql="select * from Free_Jzw order by id desc"              
set rs=server.createobject("adodb.recordset")              
rs.open sql,connstr,1,1              
if rs.eof then              
response.write "<font color=#FF0000>暂时没有任何题目！</font>"                          
else              
const maxperpage=100              
dim currentpage              
rs.pagesize=maxperpage              
currentpage=request.querystring("pageid")              
if currentpage="" then              
currentpage=1              
elseif currentpage<1 then              
currentpage=1              
else              
currentpage=clng(currentpage)              
	if currentpage > rs.pagecount then              
	currentpage=rs.pagecount              
	end if              
end if              
              
if not isnumeric(currentpage) then              
currentpage=1              
end if              
dim totalput,n              
totalput=rs.recordcount              
if totalput mod maxperpage=0 then              
n=totalput\maxperpage              
else              
n=totalput\maxperpage+1              
end if              
if n=0 then              
n=1              
end if              
rs.move(currentpage-1)*maxperpage              
i=0     
w=1         
do while i< maxperpage and not rs.eof               
%>
    <tr>
      <td width="58" bgcolor="#FFFFFF">
        <p align="center"><font color="#800000"><%=w%></font></p>
      </td>
      <td width="539" bgcolor="#FFFFFF">&nbsp;<font color="#008080"><%=rs("question")%></font>    
      <%if session("admin")<>"" then%>                                                                            
    &nbsp;<a href="edit.asp?id=<%=rs("id")%>"><font color="#008000">编辑</font></a>&nbsp;<a href="del.asp?id=<%=rs("id")%>"><font color="red">删除</font></a>       
        <%end if%>       
      </td>     
      <td width="156" bgcolor="#FFFFFF">  
      <p align="center"> 
      <INPUT onClick="MM_popupMsg('答案：<%=rs("key")%>')" type=button value=答案 name=button<%=rs("id")%> style="font-size: 12px"></p> 
      </td>    
    </tr>    
    <%                                                                                          
    i=i+1      
    w=w+1                                                                      
    rs.movenext                                                                             
    loop                                                                                                  
    end if        
    rs.close                                                   
    %>     
    <tr>    
      <td width="757" height="25" bgcolor="#FFFFFF" colspan="3">    
      <p align="center">页数：<%=currentpage%>/<% =n%>                                                                      
   	<%k=currentpage                                                                                                
   	if k<>1 then%>                                                                         
   	<a href="index.asp?pageid=1">首页</a>                                                                                                
   	<a href="index.asp?pageid=<%=k-1%>">上一页</a>                                                                                                
   	<%else%>                                                                            
   	首页&nbsp;上一页                                                                                                
   	<%end if%>                                                                         
   	<%if k<>n then%>                                                                                                
   	<a href="index.asp?pageid=<%=k+1%>">下一页</a>                                                                                                
   	<a href="index.asp?pageid=<%=n%>">尾页</a>                                                                                                
   	<%else%>                                                                            
   	下一页&nbsp;尾页                                                                                                
   	<%end if%>                                                                         
        共有<%=totalput%>道题目</p>       
      </td>     
    </tr> 
    <tr> 
    <td colspan="3" width="757" bgcolor="#FFFFFF"> 
<p align="center" style="margin-top: 2; margin-bottom: 2">       
      <%        
      p=1       
      for j=1 to n step 1       
      if k=p then       
      response.write "<font color=red style=font-size:12px>"&p&"</font>&nbsp;&nbsp;"       
      else       
      response.write "<font style=font-size:12px><a href=index.asp?pageid="&p&">"&p&"</a></font>&nbsp;&nbsp;"    
      if j mod 25=0 then   
      response.write "<p align=center style=margin-top: 2; margin-bottom: 2>"   
      end if      
      end if       
      p=p+1        
      next        
      %>
    </td>
    </tr>
  </table>
  </center>
</div>
<!--#include file="Foot.asp"-->
</body>
</html>