内容显示页
 
类别:ASP+VBS | 浏览(151) | 2006-10-17 17:38:00 | 关闭广告

<!--#include file="../conn.asp"--><!--#include file="../function/function.asp"-->
<%if session("username")="" then response.Redirect "Admin_Index.asp"%>
<link href="css.css" rel="stylesheet" type="text/css" />
<% 
 lanmu="评论"
 table="Comment"
 modiurl="?developer=yongfa365"
 Normalurl="?developer=yongfa365"
 action=request("action")
 select case action
  case "add"
   call add()
  case "addok"
   call addok()
   response.redirect Normalurl
  case "modi"
   call modi()
  case "modiok"
   call modiok()
   response.redirect Normalurl
  case "delok"
   call delok()
   response.redirect Normalurl
  case "show"
   call show()
  case else
   call list()
 end select

%>
<%Sub add()%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100%  align='center'>
<form name="form1" method="post" action="?action=addok" >
  <tr class="title">
    <td colspan="2">添加<%=lanmu%></td>
    </tr>
  <tr class="tr">
    <td width="45%" align="right">标题:</td>
    <td width="55%"><input type="text" name="txtTitle"  size="20" class="form"/></td>
  </tr>
  <tr class="tr">
    <td colspan="2" align="center"><input type="submit" name="Submit3" value="添加" />
      <input type="reset" name="Submit4" value="重置" /></td>
    </tr>
</form>
</table>
<%End Sub%>

<%Sub modi()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where  id="&request("id")
rs.open sql,conn,1,3
if not rs.eof then
%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100%  align='center'>
<form name="form1" method="post" action="?action=modiok" >
  <tr class="title">
    <td colspan="2">修改<%=lanmu%></td>
    </tr>
  <tr class="tr">
    <td width="44%" align="right">标题:</td>
    <td width="56%"><input type="text" name="txtTitle"  size="20" class="form" value="<%=rs("txtTitle")%>"/>
      <input type="hidden" name="id" value="<%=rs("id")%>" /></td>
  </tr>
  <tr class="tr">
    <td colspan="2" align="center"><input type="submit" name="Submit5" value="修改" />
      <input type="reset" name="Submit6" value="重置" /></td>
    </tr>
</form>
</table>
<%end if%>
<%End Sub%>

<%Sub show()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where  id="&request("id")
rs.open sql,conn,1,1
if not rs.eof then
%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100%  align='center'>
  <tr class="title">
    <td colspan="2"><%=lanmu%>详细信息</td>
  </tr>
  <tr class="tr">
    <td width="45%" align="right">标题:</td>
    <td width="55%"><%=rs("txtTitle")%></td>
  </tr>
  <tr class="tr">
    <td colspan="2" align="center"><input type="button" name="Submit7" value="&lt;-返回-&gt;" onclick="window.history.go(-1)" /></td>
  </tr>
</table>
<%end if%>
<%End Sub%>

<%Sub list()%>
<table border=1 bordercolor=#3770A9 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=100%  align='center'>
  <tr class="title">
    <td colspan="4"><%=lanmu%>列表</td>
  </tr>
  <tr class="tr">
    <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <form id="form2" name="form2" method="post" action="">
          <tr>
            <td colspan="3"><input type="button" name="Submit" value="添加<%=lanmu%>" onclick="window.location.href='?action=add'" />
              标题:
              <input type="text" name="txtTitle" />
              <input type="submit" name="Submit2" value="搜索" /></td>
          </tr>
        </form>
      </table></td>
  </tr>
  <tr class="title2">
    <td width="5%">编号</td>
    <td width="42%">标题</td>
    <td width="43%">&nbsp;</td>
    <td width="10%">操作</td>
  </tr>
 <%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where  id<>0 "
if request("txtTitle")<>"" then sql=sql&" and txtTitle like '%"&request("txtTitle")&"%'"
sql=sql&" order by id desc"
response.Write sql
rs.open sql,conn,1,1
call SetPage(rs,pagecount,10)
for i=1 to rs.recordcount
if rs.eof then exit for
%>
  <tr class="tr">
    <td><%=rs("id")%></td>
    <td><a href="?action=show&id=<%=rs("id")%>"><%=rs("txtTitle")%></a>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="center"><a href="<%=modiurl%>&action=modi&ID=<%=rs("ID")%>">修改</a>&nbsp;<a href="<%=modiurl%>&action=delok&ID=<%=rs("ID")%>" onClick="return confirm('确定删除?')">删除</a></td>
  </tr>
<%
rs.movenext
if i>rs.PageSize then exit for
next

%>
</table>
<%
call PrintPage(pagecount, rs, Normalurl)
%>
<%End Sub%>

<%Sub addok()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table
rs.open sql,conn,1,3
rs.addnew
rs("txtTitle")=request("txtTitle")
'rs("")=request("")
rs.update
rs.close
%>
<%End Sub%>

<%Sub modiok()%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
sql="select * from "&table&" where  id="&request("id")
rs.open sql,conn,1,3
if not rs.eof then
rs("txtTitle")=request("txtTitle")
'rs("")=request("")
rs.update
end if
rs.close
%>
<%End Sub%>

<%Sub delok()%>
<%conn.execute("delete from "&table&" where id in("&request("id")&")")%>
<%End Sub%>


引用本页地址:http://www.yongfa365.com/item/51c2d2f5202b5f08.html
 
上一篇:真的会这样嘛
下一篇:页面底部常用
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片看不清? 换张图试试
 
   
 
 
文章分类
 
   

Power by :柳永法(yongfa365)'Blog | Model by :hibaidu | CSS by:众网友 | 京ICP备07011491号  QQ:64049027  E-mail:64049027qq.com

本空间赞助商:北京中科兴联信息技术有限公司