www.gusucode.com > 漂亮的地方旅游景点景观介绍网站源代码 > admin/sys/notice.asp
<!--#include file="../config.asp" --> <!--#include file="../../inc/page.asp" --> <% call zwtj() mytit=mytit&"<a href=?>公告管理</a> > " select case action case "add" mytit=mytit&"添加公告" call add() case "del" call del() case "show","" mytit=mytit&"公告列表" call show() case "ups" mytit=mytit&"设置公告" call ups() case "aadd" call aadd() case "doup" call doup() end select '显示 sub show() sql="select * from Jw_notice order by id desc" call record(rs,sql,1) call head() %> <table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#116BAE"> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td id="tit"><%= mytit %> || <a href="?action=add">添加公告 </a></td> </tr> <tr> <td> <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <form name="form1" id="form1" method="post" action=""> <tr> <td width="4%" align="center" bgcolor="#C5E0F3"><strong>ID</strong></td> <td width="93%" bgcolor="#C5E0F3"><strong>公告名称</strong></td> <td width="3%" align="center" bgcolor="#C5E0F3"><input type="checkbox" name="selectall" onClick="selectit()"/></td> </tr> <% dim i,sz sz=20 i=sz dim bgc %> <div style="display:none"><% call fenpage(sz,rs,10) %></div> <% do while not rs.eof and i>0 if i mod 2=0 then bgc="#D2E9FF" else bgc="#D2E1EE" end if %> <tr id="r<%=rs("id")%>" bgcolor=<%= bgc %> onMouseOver="museing(r<%=rs("id")%>,0,'<%= bgc %>')" onMouseOut="museing(r<%=rs("id")%>,1,'<%= bgc %>')"> <td align="center"><%= rs("id") %></td> <td><a href="?action=ups&id=<%= rs("id") %>"><%= rs("mc") %> </a></td> <td align="center"><input name="idstr" type="checkbox" value="<%= rs("id") %>" onclick="td_bgcolor(r<%=rs("id")%>,1);"></td> </tr> <% i=i-1 rs.movenext loop %> <tr> <td colspan="3" bgcolor="#C5E0F3"> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td><input name="del" type="button" class="btn2" id="del" value="- = 删除所选 = -" onMouseUp="tjqr('您确定要删除?此操作无法逆转!','?action=del')"></td> <td><% call fenpage(sz,rs,10) %></td> </tr> </table></td> </tr> </form> </table></td> </tr> </table></td> </tr> </table> <% call recordend(rs) call connend() call foot() end sub '添加 sub add() call head() %> <table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#116BAE"> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td id="tit"><%= mytit %></td> </tr> <tr> <td> <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF"> <form action="?action=aadd" name="form1" id="form1" method="post"> <tr> <td width="10%" bgcolor="#D9ECF7">公告名称:</td> <td width="90%" bgcolor="#D9ECF7"><input name="mc" type="text" class="inp" id="mc" size="50" onfocus="this.className='focus'" onblur="this.className='inp'"></td> </tr> <tr> <td bgcolor="#D9ECF7">公告内容:</td> <td bgcolor="#D9ECF7"> <textarea name="content" cols="60" rows="6" class="inp" id="content" onfocus="this.className='focus'" onblur="this.className='inp'"></textarea> </td> </tr> <tr> <td colspan="2" bgcolor="#D9ECF7"><input name="del2" type="submit" class="btn2" id="del2" value="- = 提交 = -"></td> </tr> </form> </table> </td> </tr> </table> </td> </tr> </table> <% call connend() call foot() end sub '执行添加 sub aadd() dim mc,content mc=Trim(Request.Form("mc")) content=Trim(Request.Form("content")) conn.begintrans'事务开始 conn.execute("insert into Jw_notice(mc,content,admin_name,ctim) values ('"&mc&"','"&content&"','"&request.cookies(fmid)("admin_name")&"',now())") if conn.errors.count>0 then ''有错误发生 conn.rollbacktrans''回滚 end if conn.CommitTrans ''提交事务 call connend() response.Redirect("?") end sub '修改 sub ups() set rs=conn.execute("select * from Jw_notice where id="&id) if rs.eof then call cc("记录不存在!") end if call head() %> <table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#116BAE"> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td id="tit"> <%= mytit %> || <a href="?action=add">添加公告</a></td> </tr> <tr> <td> <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF"> <form action="?action=doup&id=<%= id %>" name="form1" id="form1" method="post"> <tr> <td width="10%" bgcolor="#D9ECF7">公告名称:</td> <td width="90%" bgcolor="#D9ECF7"><input name="mc" type="text" class="inp" id="mc" size="50" value="<%= rs("mc") %>" onfocus="this.className='focus'" onblur="this.className='inp'"></td> </tr> <tr> <td bgcolor="#D9ECF7">公告内容:</td> <td bgcolor="#D9ECF7"> <textarea name="content" cols="60" rows="6" class="inp" id="content" onfocus="this.className='focus'" onblur="this.className='inp'"><%= rs("content") %></textarea> </td> </tr> <tr> <td bgcolor="#D9ECF7">最后更新:</td> <td bgcolor="#D9ECF7"><input disabled="disabled" name="lastm" type="text" class="inp" id="lastm" size="50" value="<%= rs("lastm") %>" onfocus="this.className='focus'" onblur="this.className='inp'"/></td> </tr> <tr> <td colspan="2" bgcolor="#D9ECF7"><input name="del2" type="submit" class="btn2" id="del2" value="- = 提交 = -"></td> </tr> </form> </table> </td> </tr> </table> </td> </tr> </table> <% call connend() call foot() end sub '执行修改 sub doup() dim mc,content mc=Trim(Request.Form("mc")) content=Trim(Request.Form("content")) conn.begintrans'事务开始 '更新记录 conn.execute("update Jw_notice set mc='"&mc&"',content='"&content&"' where id="&id) call zhgx("Jw_notice",id) if conn.errors.count>0 then ''有错误发生 conn.rollbacktrans''回滚 end if conn.CommitTrans ''提交事务 call connend() response.Redirect("?") end sub '删除 sub del() '批量删除 dim idstr,iid,i idstr=replace(Trim(Request.Form("idstr"))," ","") iid=split(idstr,",") for i=0 to ubound(iid) conn.execute("delete * from Jw_notice where id="&iid(i)) next call connend() response.Redirect(request.ServerVariables("HTTP_REFERER")) end sub %>