📄 news2.asp
字号:
<!--#include file="../include/dbopenbd.asp"-->
<!--#include file="checkadmin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked;
}
}
</script>
</head>
<BODY background="../images/admin/back.gif">
<%
allpages=0
page=1
totalrec=0
per_page_num=5
url="news2.asp"
'参数
action=request("action")
'列表显示情况
if action="" then call news_index()
'添加、修改的显示和提交处理开始
id=request("id")
'提交
if action="newsok" then call newsok()
'显示
if action="modify" then call newsmodify()
'多选功能处理开始
ids=replace(request("id"),"'","")
if ids="" then mGoBack "您什么也没有选择,单击“确定”返回上一页!"
'关闭
if action="关闭" then call newsclose()
'打开
if action="打开" then call newsopen()
'删除
if action="删除" then call newsdel()
sub news_index()
%>
<table width="98%" border="1" style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<form action=<%=url%> method=post name=adv>
<tr class=backs><td colspan=5 class=td height=18>图片新闻设置</td></tr>
<tr bgcolor="#003366" align=center>
<td width=5%>选</td>
<td width=50%>标题(单击标题编辑新闻)</td>
<td width=15%>图片地址</td>
<td width=15%>链接地址</td>
<td width=10%>状态</td></tr>
<%
Set rs = conn.Execute("select * from s_gundong")
while not rs.eof
%>
<tr><td height=18 class=b><input type='checkbox' value='<%=Cstr(rs("id"))%>' name=id></td>
<td><a href="news2.asp?action=modify&id=<%=Cstr(rs("id"))%>" title='编辑这条图片新闻' ><%=rs("Title")%></a></td>
<td><%=rs("picurl")%></td>
<td><%=rs("hrefurl")%></td>
<td><% if rs("status")=true then response.write "显示 " else response.write "<font color=red><b>隐藏</b></font>" end if%></td>
</tr>
<%
rs.movenext
wend
rs.close
conn.close
set rs=nothing
set coon=nothing
%>
<tr><td colspan=5 class=b>
<input type='checkbox' name=chkall onclick='CheckAll(this.form)'>全选
<input type="submit" name="action" value="关闭" onclick="{if(confirm('确定隐藏这条新闻吗?')){this.document.newslist.submit();return true;}return false;}">
<input type="submit" name="action" value="打开" onclick="{if(confirm('确定要显示这条新闻吗?')){this.document.newslist.submit();return true;}return false;}">
<input type="submit" name="action" value="删除" onclick="{if(confirm('该操作不可恢复!\n\n确定删除选定的新闻?')){this.document.newslist.submit();return true;}return false;}">
<input type="button" name="action" onclick="javascript:location.href='news2.asp?action=modify';" value="添加新闻">
</td></tr>
</form></table>
<%
response.End()
end sub
sub newsopen()
sql="update s_gundong set status=1 where id in ("&ids&")"
conn.execute sql
mGoTo url,"所选新闻文章已被打开!"
end sub
sub newsclose()
sql="update s_gundong set status=0 where id in ("&ids&")"
conn.execute sql
mGoTo url,"所选新闻文章已被关闭!"
end sub
sub newsdel()
sql="delete from s_gundong where id in ("&ids&")"
conn.execute sql
mGoTo url,"所选新闻已被删除,单击“确定”返回新闻列表!"
end sub
sub newsok()
Set rs=Server.CreateObject("ADODB.Recordset")
if id="" then
sql = "select * from s_gundong where 1=2"
rs.open sql,conn,1,3
rs.Addnew
else
sql = "select * from s_gundong where id="&id
rs.open sql,conn,1,3
end if
rs("title")=request.form("title")
rs("picurl")=request.form("picurl")
rs("hrefurl")=request.form("hrefurl")
rs("status")=request.form("status")
rs.update
rs.close
conn.close
set rs=nothing
set conn=nothing
mGoTo url,"操作成功,单击“确定”返回新闻列表!"
end sub
sub newsmodify()
if id<>"" then
set rs = server.createobject("adodb.recordset")
sql = "select * from s_gundong where id="&id
rs.open sql,conn,1,1
if not (rs.eof and rs.bof) then
title=rs("title")
picurl=rs("picurl")
hrefurl=rs("hrefurl")
status=rs("status")
end if
rs.close
set rs=nothing
end if
%>
<table width="98%" border="1" style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<form name="editnews" method="post" action='news2.asp?action=newsok&id=<%=id%>'>
<tr class=backs><td class=td height=18>编辑图片新闻</td></tr>
<TR><TD>新闻标题:<input name="title" type="text" value="<%=title%>" size="50" maxlength="50"></TD></TR>
<TR><TD>图片地址:<input name="picurl" type="text" value="<%=picurl%>" size="50" maxlength="50"></TD></TR>
<TR><TD>链接地址:<input name="hrefurl" type="text" value="<%=hrefurl%>" size="50" maxlength="50"></TD></TR>
<TR><TD>是否显示:<input type="radio" name="status" value="0" checked>否<input type="radio" name="status" value="1" <%if status=true then%>checked<%end if%>> 是</TD></TR>
<TR><TD><input type="submit" name="submit" value="提交修改"> <input type="reset" name="Submit2" value="重新修改"></TD></TR>
</form></TABLE>
<%
response.end
end sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -