⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boardlist.asp

📁 A Design and Implementation of The Online Shopping System Abstract: Along with the development
💻 ASP
字号:
<!--#include File="../ConnDB.asp"-->
<!--#include file="isAdmin.asp"-->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>公告管理</title>
<link href="../style.css" rel="stylesheet">
<script language="javascript">
function BoardWin(url) {
  var oth="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=200,top=200";
  oth = oth+",width=400,height=300";
  var BoardWin = window.open(url,"BoardWin",oth);
  BoardWin.focus();
  return false;
}

function SelectChk()
{
  var s = false; //用来记录是否存在被选中的复选框
  var Boardid, n=0; 
  var strid, strurl;
  var nn = self.document.all.item("Board"); //返回复选框Board的数量
  for (j=0; j<nn.length; j++) {
    if (self.document.all.item("Board",j).checked) {
      n = n + 1;
      s = true;
      Boardid = self.document.all.item("Board",j).id+"";  //转换为字符串
      //生成要删除公告编号的列表
      if(n==1) {
        strid = Boardid;
      }
      else {
        strid = strid + "," + Boardid;
      }
    }
  }
  strurl = "BoardDelt.asp?id=" + strid;
  if(!s) {
    alert("请选择要删除的公告!");
    return false;
  }	
  if (confirm("你确定要删除这些公告吗?")) {
    form1.action = strurl;
	form1.submit();
  }
}

function sltAll()
{
	var nn = self.document.all.item("Board");
	for(j=0;j<nn.length;j++)
	{
		self.document.all.item("Board",j).checked = true;
	}
}
function sltNull()
{
	var nn = self.document.all.item("Board");
	for(j=0;j<nn.length;j++)
	{
		self.document.all.item("Board",j).checked = false;
	}
}
</script>
</head>
<body link="#000080" vlink="#080080">
<form name="form1" method="POST">
<%
  '设置SQL语句,查询表Board中的公告信息,读取到rs对象中
  Dim rs
  Set rs = Server.CreateObject("ADODB.RecordSet")
  sql = "Select * From Board Order By PostTime Desc"
  Dim n  '用来保存记录数量
  rs.Open sql,Conn,1,1
  '如果rs为空,则显示提示信息
  If rs.EOF Then
    Response.Write "<tr><td colspan=5 align=center>目前还没有公告。</td></tr></table>"
  Else
%>
<p align=center><font style='FONT-SIZE:12pt' color="#000080"><b>公 告 管 理</b></font></p>
<table align=center border="1" cellspacing="0" width="100%" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF" style='FONT-SIZE: 9pt'>
  <tr>
   <td width="6%" align="center" bgcolor="#BEDCFA"><strong>编号</strong></td>
   <td width="50%" align="center" bgcolor="#BEDCFA"><strong>题目</strong></td>
   <td width="24%" align="center" bgcolor="#BEDCFA"><strong>时间</strong></td>
   <td width="10%" align="center"  bgcolor="#BEDCFA"><strong>修改</strong></td>
   <td width="10%" align="center"  bgcolor="#BEDCFA"><strong>选择</strong></td>
  </tr>
<%
    '设置每页记录数量为15
	rs.PageSize = 15
	'设置并读取页码参数page
	iPage = CLng(Request("page"))
	If iPage <=0 Then
	  iPage = 1
	End If
	If iPage > rs.PageCount Then
	  iPage = rs.PageCount
	End If
    
    RowCount = rs.PageSize
    '依次显示公告信息
    Do While Not rs.EOF And RowCount > 0
      n = n + 1
%>
  <tr>
    <td align="center"><%=n%></td>
    <td><a href="../BoardView.asp?id=<%=rs("id")%>" onClick="return BoardWin(this.href)"><%=rs("title")%></a></td>
	<td align="center"><%=rs("posttime")%></td>
    <td align="center"><a href="BoardEdit.asp?id=<%=rs("id")%>" onClick="return BoardWin(this.href)">修改</a></td>
    <td align="center"><input type="checkbox" name="Board" id="<%=rs("id")%>" style="font-size: 9pt"></td>
  </tr>
<%
      rs.MoveNext()
      '控制每页显示记录的数量
      RowCount = RowCount - 1
    Loop
%>
</table>
<%
    '显示页码链接
    If rs.PageCount>1 then
      Response.Write "<table border='0'><tr><td><b>分页:</b></td>"
      For i=1 to rs.PageCount
        Response.Write "<td><a href='BoardList.asp?page=" & i & "'>"
        Response.Write "[<b>" & i & "</b>]</a></td>"
      Next
      Response.Write "</tr></table>"
    End If
  End If
%>
		
		<p align="center">
		<input type="button" value="添加公告" onclick="BoardWin('BoardAdd.asp')" name=add>
		 &nbsp;&nbsp;<input type="button" value="全 选" onclick="sltAll()" name=button1>
		 &nbsp;&nbsp;<input type="button" value="清 空" onclick="sltNull()" name=button2>
 		 &nbsp;&nbsp;<input type="submit" value="删 除" name="tijiao" onclick="SelectChk()">
<br><br>
<input type=hidden name="Board">
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -