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

📄 ad_lb.asp

📁 自己做的毕业设计
💻 ASP
字号:
<!--#include file=pass.asp--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
a:link {
	color: #333333;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #333333;
}
a:hover {
	text-decoration: underline;
	color: #0099CC;
}
a:active {
	text-decoration: none;
}
.style4 {	font-size: 16px;
	font-family: "黑体";
	color: #0066CC;
}
.style5 {color: #0066CC}
body {
	margin-left: 0px;
	margin-top: 0px;
	background-color: #C5D5E4;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE2 {	font-size: 16px;
	font-family: "黑体";
	color: #FFFFFF;
}
.STYLE10 {font-size: 16px; font-family: "黑体"; color: #000000; }
-->
</style>
</head>
<!--#include file = "conn.asp" -->
<body>
<%
if request("act")="add" then
conn.execute("insert into [lb](name)values('"&trim(request("name"))&"')")
end if
if request("act")="del" then
conn.execute("delete from [lb] where id="&request("id"))
end if
if request("act")="edit" then
conn.execute("update [lb] set name='"&trim(request("name"))&"' where id="&request("id"))
end if
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="20">
    <%if request("show")="" then%>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C5D5E4">
        <tr>
          <td width="1008" height="30" align="center" valign="middle" background="../img/menubg.gif" class="STYLE2">图书类别管理</td>
        </tr>
        
        <tr>
          <td height="40" align="center" valign="middle"><table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" >
            
            <tr>
              <td valign="top">

			  <%
		sql="select * from lb order by id asc"		
		set rs=server.createobject("adodb.recordset")
		rs.open sql,conn,1,1
		if rs.recordcount=0 then %>
                  <table width="100%" border="0" cellspacing="0" cellpadding="5" align="center">
                    <tr>
                      <td align="center">暂无相关信息!</td>
                    </tr>
                  </table>
                <%
		else
	  		rs.PageSize =10
			iCount=rs.RecordCount 
			iPageSize=rs.PageSize
    		maxpage=rs.PageCount 
    		page=request.QueryString("page")
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    rs.AbsolutePage=Page
	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	%>
                  <table width="500" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#E7EEF5">
                    <tr>
                      <td width="21%"  height="25" align="center" valign="middle" bgcolor="#C5D5E4"><strong>ID</strong></td>
                      <td width="17%"  height="25" align="center" valign="middle" bgcolor="#C5D5E4"><strong>名称</strong></td>
                      <td width="12%" height="25" align="center" valign="middle" bgcolor="#C5D5E4" ><strong>修改</strong></td>
                      <td width="11%" align="center" valign="middle" bgcolor="#C5D5E4" ><strong>操作</strong></td>
                    </tr>
                    <%
			For i=1 To x
			%>
                    <tr>
                      <td  height="25" align="center" valign="middle" bgcolor="#C5D5E4"><%=trim(rs("id"))%></td>
                      <td  height="25" align="center" valign="middle" bgcolor="#C5D5E4"><%=trim(rs("name"))%></td>
                      <td  height="25" align="center" valign="middle" bgcolor="#C5D5E4"><a href="?show=edit&id=<%=rs("id")%>" target="_self">修改</a></td>
                      <td align="center" valign="middle" bgcolor="#C5D5E4"><a href="?act=del&id=<%=rs("id")%>" target="_self">删除</a></td>
                    </tr>
                   
                    <%
			rs.movenext
		    next
			%> <tr>
                      <td height="35" colspan="4"  align="center" valign="middle" bgcolor="#C5D5E4"><input onClick="window.location='ad_lb.asp?show=add'" type="button" name="button3" id="button3" value="  添 加  "></td>
                      </tr>
                  </table>
                <%
		call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
		end if
		rs.close
		set rs=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
    Dim query, a, x, temp
    action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
    For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), "page", vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
        End If
    Next
    Response.Write("<table width=90% border=0 cellpadding=0 cellspacing=0  align=center >" & vbCrLf )        
    Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
    Response.Write("<TD align=center height=35>" & vbCrLf )
    Response.Write(font_style & vbCrLf )    
    if page<=1 then
        Response.Write ("首页 " & vbCrLf)        
        Response.Write ("上页 " & vbCrLf)
    else        
        Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> " & vbCrLf)
    end if
    if page>=pagecount then
        Response.Write ("下页 " & vbCrLf)
        Response.Write ("尾页 " & vbCrLf)            
    else
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">尾页</A> " & vbCrLf)            
    end if
    Response.Write(" 页次:" & page & "/" & pageCount & "页" &  vbCrLf)
    Response.Write(" 共有" & iCount & "条" &  vbCrLf)
    Response.Write(" 转到" & "<INPUT TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=" & page & ">" & "页"  & vbCrLf & "<INPUT type=submit value=GO>")
    Response.Write("</TD>" & vbCrLf )                
    Response.Write("</TR>" & vbCrLf )        
    Response.Write("</table>" & vbCrLf )        
End Sub
%>              </td>
            </tr>
          </table>
          <%end if%>
          <%if request("show")="add" then%>
            <form method="POST" action="?act=add">
              <center>
                <table width="68%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">
                  <tr bgcolor="#B6EBC4">
                    <td bgColor="#C5D5E4" height="25"><p align="center"><b>增加类别</b></td>
                  </tr>
                  <tr>
                    <td height="21" align="middle" bgcolor="#DFE8F0" style="BORDER-BOTTOM: medium none"><div align="center"><br>
                      名称:
                          <input name="name" id="name" size="20" maxlength="20">
                    </div></td>
                  </tr>
                 
                  <tr>
                    <td height="25" bgcolor="#DFE8F0" style="BORDER-TOP: medium none"><p align="center"><input type="submit" value="确定添加" name="B1">
                    </td>
                  </tr>
                </table>
              </center>
          </form>
          <%end if%>
          <%if  request("show")="edit" then%>
          <%
		  on error resume next
		  id=request("id")
		  set rse=conn.execute("select * from lb where id="&id)
%>
            <table width="68%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">
              <tr bgcolor="#B6EBC4">
                <td align="center" height="25" bgcolor="#C5D5E4"><b>修改类别</b></td>
              </tr>
              <tr>
                <td height="75" bgcolor="#EBF0F5"><form method="POST" action="?act=edit&id=<%=id%>" style="line-height: 150%; margin-top: 0; margin-bottom: 0">
                    <p align="center" style="line-height: 200%; margin-top: 0; margin-bottom: 0">名称:
                      <input name="name" id="name" value="<%=rse("name")%>" size="20" maxlength="20">
                    </p>
                  <p align="center" style="line-height: 200%; margin-top: 0; margin-bottom: 0">
                      <input type="submit" value="确定修改" name="editchk">
                  </p>
                </form></td>
              </tr>
            </table>
            <%end if%></td>
        </tr>
      </table>
 </td>
  </tr>
</table>



</body>
</html>

⌨️ 快捷键说明

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