www.gusucode.com > 漂亮的地方旅游景点景观介绍网站源代码 > admin/news/newsbj.asp
<!--#include file="../config.asp" --> <!--#include file="../../inc/page.asp" --> <% call zwtj() call chkqx(9,8) mytit=mytit&"<a href=""newsbj.asp"">编辑管理</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_infos where lx='bj' order by id desc" call record(rs,sql,1) call head() %> <link href="../inc/mm.css" rel="stylesheet" type="text/css" /> <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="3%" align="center" bgcolor="#C5E0F3"><strong>ID</strong></td> <td width="94%" 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=<%= 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 width="100%" border="0" cellpadding="2" cellspacing="0"> <tr> <td width="11%"><input name="del" type="button" class="button_1" id="del" value="删除所选" onMouseUp="tjqr('您确定要删除?此操作无法逆转!','?action=del')" onmouseover="this.className='button_2'" onmouseout="this.className='button_1'"></td> <td width="89%"><% 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 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="button_1" id="del2" value="提交" onmouseover="this.className='button_2'" onmouseout="this.className='button_1'"></td> </tr> </form> </table> </td> </tr> </table> </td> </tr> </table> <% call connend() call foot() end sub '执行添加 sub aadd() dim mc,content,lx mc=getForm("mc",1,0) content=outhtml(getForm("content",1,0)) lx="bj" conn.begintrans'事务开始 conn.execute("insert into Jw_infos(mc,ctim,content,lx) values ('"&mc&"',now(),'"&content&"','"&lx&"')") if conn.errors.count>0 then ''有错误发生 conn.rollbacktrans''回滚 end if conn.CommitTrans ''提交事务 call connend() response.Redirect("newsbj.asp") end sub '修改 sub ups() set rs=conn.execute("select * from Jw_infos 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 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"><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 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 colspan="2" bgcolor="#D9ECF7"><input name="del2" type="submit" class="button_1" id="del2" value="提交" onmouseover="this.className='button_2'" onmouseout="this.className='button_1'"></td> </tr> </form> </table> </td> </tr> </table> </td> </tr> </table> <% call connend() call foot() end sub '执行修改 sub doup() dim mc,content mc=getForm("mc",1,0) content=outhtml(getForm("content",1,0)) conn.begintrans'事务开始 '更新记录 conn.execute("update Jw_infos set mc='"&mc&"',content='"&content&"' where id="&id) call zhgx("Jw_infos",id) if conn.errors.count>0 then ''有错误发生 conn.rollbacktrans''回滚 end if conn.CommitTrans ''提交事务 call connend() response.Redirect("newsbj.asp") end sub '删除 sub del() '删除单条记录 if id<>"" then conn.execute("delete * from Jw_infos where id="&id) end if '批量删除 dim idstr,iid,i idstr=replace(Trim(Request.Form("idstr"))," ","") iid=split(idstr,",") for i=0 to ubound(iid) conn.execute("delete * from Jw_infos where id="&iid(i)) next call connend() response.Redirect(request.ServerVariables("HTTP_REFERER")) end sub %>