<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
if request("mtype")="" then
	sqltext="select * from yswhb order by id desc"
else
	sqltext="select * from yswhb where mtype='"&request("mtype")&"' order by id desc"
end if
rs.open sqltext,conn,1,1
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="images/site.css" type=text/css rel=stylesheet>
<title>上饶折扣网---折扣消费大舞台!</title>
<style>
<!--
td {
	font-family: Arial, Helvetica, sans-serif;
}
.style5 {font-size: 14px}
a:link {
	text-decoration: none;
}
.style4 {color: #e20000}
.style3 {color: #FF0000}
.style1 {	color: #FF0000;
	font-weight: bold;
}
.cm_rlink {
	FILTER: alpha(opacity=100); LEFT: 0px; POSITION: absolute; TOP: 0px
}
.poll {
	FONT-SIZE: 9pt; WORD-SPACING: -3px; FONT-FAMILY: "&#46027"; arial
}
-->
</style>
</head>

<body bgColor=#ffffff leftMargin=1 background="images/right_bg2.gif" topMargin=0 style="text-align: right">
<!-- #include file="top.asp"-->

<!-- Top顶部表格 -->
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table2" height="238" bgcolor="#FFFFFF">
	<tr>
		<td background="images/left_bg2.gif" width="9">　</td>
		<td valign="top" width="180" bgcolor="#FFFFFF">
		<!-- #include file="left.asp"-->
</td>
		<td width="9" background="images/left_bg1.gif">　</td>
		<td width="9">　</td>
		<td width="518" valign="top">
		<table border="0" width="100%" id="table12">
			<tr>
				<td>
                <p align="center"><img border="0" src="images/11.jpg"></p>
                </td>
			</tr>
			<tr>
				<td>　</td>
			</tr>
			<tr>
				<td>
<%dim MaxPerPage
MaxPerPage=20

'假如没有数据时
If rs.eof and rs.bof then 
   call emptylist
   call showpages

   CurrentPage=1

else

'取得页数,并判断用户输入的是否数字类型的数据，如不是将以第一页显示
dim text,checkpage
text="0123456789"
 Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
   checkpage=instr(1,text,mid(request("page"),i,1))
   if checkpage=0 then
      exit for 
   end if
next

If checkpage<>0 then
      If NOT IsEmpty(request("page")) Then
        CurrentPage=Cint(request("page"))
        If CurrentPage < 1 Then CurrentPage = 1
        If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
      Else
        CurrentPage= 1
      End If
      If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
   CurrentPage=1
End if
call list
call showpages


If Rs.recordcount > MaxPerPage then
   call showpages
end if
End if
'显示帖子的子程序
Sub list()%>				
              <table border="0" width="100%" id="table13" cellspacing="1" bordercolor="#FFFFFF" bordercolorlight="#DEDEDE" cellpadding="0" bordercolordark="#FFFFFF">
				<tr style="font-size:14px">
					<td bgcolor="#FF6600" height="31" align="center" width="277">
					<font color="#FFFFFF">&nbsp;标题</font></td>
					<td bgcolor="#FF6600" height="31" align="center">
					<font color="#FFFFFF">发布日期</font></td>
				</tr>
<%                                 
if not rs.eof then                                 
  i=0                                 
  do while not rs.eof                                  
%> 				
				<tr <%if i mod 2=0 then response.write "bgcolor=#EFEFEF"%>>
					<td height="28" width="277">·<a  href="yswhdetail.asp?id=<%=rs("id")%>"  style="font-size:14px"><%=rs("title")%></a></td>
					<td height="28" align="center"><%=formatdatetime(rs("dateandtime"),2)%></td>
				</tr>
<%                                 
   i=i+1                                 
   if i >= MaxPerpage then exit do                                 
   rs.movenext                                 
   loop                                 
end if                                 
%> 				</table>
<%                                 
End sub                                 

'显示空帖子的子程序
Sub emptylist()%>				
              <table border="0" width="100%" id="table13" cellspacing="1" bordercolor="#FFFFFF" bordercolorlight="#DEDEDE" cellpadding="0" bordercolordark="#FFFFFF" height="127">
				<tr style="font-size:14px">
					<td bgcolor="#FF6600" height="30" align="center" width="73%">
					<font color="#FFFFFF">标题</font></td>
					<td bgcolor="#FF6600" height="30" align="center" width="27%">
					<font color="#FFFFFF">发布日期</font></td>
				</tr>
				<tr>
					<td height="94" colspan="2">
					<p align="center"><font color="#CC3300" style="font-size:14px">暂无
					此类信息</font></td>
				</tr>
				</table>
<%                                 
End sub                                                               
%> 	
<%'显示翻页的子程序
sub showpages()%><p>
<table width=100% background=images/bg1.gif border=0 border="0" cellPadding="0" cellSpacing="0">
<tr height=41><td >
<%
response.write "<form method=Post action='yswhlist.asp' name=111>"
mtype=request("mtype")
%>
<input type=hidden name=mtype value=<%=request("mtype")%>>
<div align="center">
<table border="0" cellPadding="0" cellSpacing="0" width="100%" >
<tr>
<td>
<%

If currentpage > 1 Then
response.write "<input type='button' class='buttonx5'  value='首页' onclick=window.location='yswhlist.asp?page="+cstr(1)+"&mtype="+mtype+"'>&nbsp;"
Response.write "<input type='button' class='buttonx5'  value='上一页' onclick=window.location='yswhlist.asp?page="+Cstr(currentpage-1)+"&mtype="+mtype+"'>&nbsp;"
Else
Response.write "<input type='button' class='buttonx5'  value='首页' disabled>&nbsp;"
Response.write "<input type='button' class='buttonx5'  value='上一页' disabled>&nbsp;"
End if

If currentpage < rs.PageCount Then
Response.write "<input type='button' class='buttonx5'  value='下一页' onclick=window.location='yswhlist.asp?page="+Cstr(currentPage+1)+"&mtype="+mtype+"'>&nbsp;"
Response.write "<input type='button' class='buttonx5'  value='尾页' onclick=window.location='yswhlist.asp?page="+Cstr(rs.PageCount)+"&mtype="+mtype+"'>&nbsp;&nbsp;"
Else
Response.write "<input type='button' class='buttonx5'  value='下一页' disabled>&nbsp;"
Response.write "<input type='button' class='buttonx5'  value='尾页' disabled>&nbsp;&nbsp;"
End if

Response.write "页次：" & Cstr(CurrentPage)&"/"&Cstr(rs.pagecount) 

response.write "</SPAN></td><td align='right'class=text3>"
response.write "转到：<input type='text' name='page' size=2 maxlength=4  value="&Currentpage&">&nbsp;"
response.write "<input type='submit'  value='Go'  name='cndok' class='buttonx5'>&nbsp;&nbsp;"
%>
</font>
</td>
</tr>
</table>
</div>
</td></tr>
</table>
</form>
<%end sub%>                                
				
				</td>
			</tr>
			<tr>
				<td>　</td>
			</tr>
			<tr>
				<td>
				<p align="center"></td>
			</tr>
			</table>
		</td>
		<td width="9">　</td>
		<td width="9" background="images/left_bg2.gif">　</td>
    <TD class=main_bg vAlign=top bgColor=#e5e5e5>  <!-- #include file="right.asp"--></TD>
		<td background="images/left_bg1.gif" width="9">　</td>
	</tr>
</table>
<!-- #include file="bottom.asp"-->
</body>

</html>