news.asp
来自「适用于网络/信息企业」· ASP 代码 · 共 262 行
ASP
262 行
<!--#include file="../INC/Conn.asp"-->
<!--#include file="inc/Check.asp"-->
<!--#include file="inc/public.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>亿博尔</title>
</head>
<link href="Images/Admin.css" rel="stylesheet" type="text/css">
<body>
<%
dim Makking,ID
Makking = Request.QueryString("Makking")
ID = Request.QueryString("ID")
select case Makking
case "save"
if Trim(Request.Form("Title"))="" or Trim(Request.Form("body"))="" then
Save_title="·请填写完整的参数"
call Save_err()
end if
if ID = "" THEN
sql ="SELECT * from News"
set rs =server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
else
sql ="SELECT * from News where ID="& ID &""
set rs =server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
END IF
rs("Title") = Trim(Request.Form("Title"))
rs("Content") = Request.Form("body")
rs("Class") = Trim(Request.Form("Class"))
rs("IP") = Request.ServerVariables("REMOTE_ADDR")
rs("DateTime") = now()
rs.update
rs.close
set rs=nothing
if ID = "" THEN
Save_title="·添加成功"
ELSE
Save_title="·修改成功"
END IF
call Save_ok()
case "del"
conn.execute("delete from News where ID="& ID &"")
Save_title="·删除成功"
call Save_ok()
case ""
%>
<table width="98%" height="40" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#D8D8D8">
<tr>
<td height="30" align="left" bgcolor="ffffff"><table width="100%" height="100%" border="0" cellpadding="3" cellspacing="0">
<tr bgcolor="eeeeee">
<td width="5%" align="center"><img src="Images/1.gif" width="13" height="12"></td>
<td width="45%"><span class="style2">管理中心 >>> 新闻管理</span></td>
<td width="50%" align="right"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="98%" height="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D8D8D8">
<tr>
<td valign="top" bgcolor="ffffff"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" bgcolor="ffffff"> <table width=100% border=0 align='center' cellpadding=3 cellspacing=1 bordercolordark=#ffffff bgcolor="eaeaea">
<tr align="left" bgcolor="ffffff" background="Images/box_bg.gif">
<td width="46%" height="20" background="Images/box_bg.gif" class='color01'>新闻标题</td>
<td width="19%" height="20" background="Images/box_bg.gif" class='color01'>所属分类</td>
<td width="17%" height="20" background="Images/box_bg.gif" class='color01'>添加时间</td>
<td height="20" background="Images/box_bg.gif" class='color01'>修改|删除</td>
</tr>
<%
sql ="SELECT * from News order by DateTime desc"
set rs =server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
'==============================page
rs.PageSize =15
%>
<!--#include file="../inc/page.asp"-->
<tr align="left" bgcolor="ffffff" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F5F5F5'">
<td width="46%" height="25"><%=rs("Title")%></td>
<td width="19%">
<%
set rsc= conn.execute("select * from NewsClass where NumberID='"& rs("Class") &"'")
if not(rsc.eof and rsc.bof) then
response.write rsc("Class")
end if
rsc.close
set rsc=nothing
%></td>
<td width="17%" height="25"><%=rs("DateTime")%></td>
<td height="25"><a href="News.asp?Makking=add&ID=<%=rs("ID")%>">修改</a>|<a href="News.asp?Makking=del&ID=<%=rs("ID")%>" onClick="return confirm('删除后将无法恢复,您确定要这样操作吗?')">删除</a></td>
</tr>
<%
rs.movenext
next
end if
%>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" height="24" align="left" background="Images/box_bg_1.gif"><a href="News.asp?Makking=add"><img src="Images/add.gif" width="36" height="21" border="0"></a></td>
<td width="50%" height="24" align="right" valign="top" background="Images/box_bg_1.gif">
<%Page_links=""
call PageControl(iCount,maxpage,page)
rs.close
set rs=nothing%></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="1" bgcolor="#E2E1E1"></td>
</tr>
</table>
</td>
</tr>
</table>
<%
case "add"
ID = Trim(Request.QueryString("ID"))
IF ID <> "" THEN
sql ="SELECT * from News where ID = " & ID
set rs =server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if not(rs.bof and rs.eof) then
NewsTitle = rs("Title")
Content = rs("Content")
ClassStr = rs("Class")
end if
rs.close
set rs=nothing
end if
%>
<table width="98%" height="40" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#D8D8D8">
<tr>
<td height="30" align="left" bgcolor="ffffff"><table width="100%" height="100%" border="0" cellpadding="3" cellspacing="0">
<tr bgcolor="eeeeee">
<td width="5%" align="center"><img src="Images/1.gif" width="13" height="12"></td>
<td width="45%"><span class="style2">管理中心 >>> 新闻添加</span></td>
<td width="50%" align="right"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="98%" height="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D8D8D8">
<tr>
<td valign="top" bgcolor="ffffff"><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" bgcolor="ffffff"> <form method='POST' name="Userform" action='News.asp?Makking=save&ID=<%=ID%>'>
<br>
<table width=100% border=0 align='center' cellpadding=3
cellspacing=1 bordercolordark=#ffffff bgcolor="#Eeeeee" City='size09'>
<tr bgcolor="ffffff">
<td width='15%' height="25" align="right" bgcolor="ffffff">新闻标题:</td>
<td height="25" bgcolor="ffffff">
<input name="Title" type="text" class="box6" id="Title" value="<%=NewsTitle%>" size="60">
</td>
</tr>
<tr bgcolor="ffffff">
<td width='15%' height="25" align="right" bgcolor="ffffff">新闻分类:</td>
<td height="25" bgcolor="ffffff">
<select name="Class">
<%
set rsc= conn.execute("Select * from NewsClass where LagID=0 order by Classorder")
if rsc.bof and rsc.eof then
response.write "<option value=0>---请添加新闻分类---</option>"
end if
While not rsc.eof
%>
<option value="<%=rsc("NumberID")%>" <%if ClassStr=rsc("NumberID") then%>selected<%end if%>><%=rsc("Class")%></option>
<%
Set Rscc = Conn.Execute("Select * From NewsClass Where PartID='"& Rsc("NumberID") &"' Order By Classorder")
While Not Rscc.Eof
%>
<option value="<%=Rscc("NumberID")%>" <%if ClassStr=Rscc("NumberID") then%>selected<%end if%>>┣<%=Rscc("Class")%></option>
<%
Set Rsccc = Conn.Execute("Select * From NewsClass Where PartID='"& Rscc("NumberID") &"' Order By Classorder")
While Not Rsccc.Eof
%>
<option value="<%=Rsccc("NumberID")%>" <%if ClassStr=Rsccc("NumberID") then%>selected<%end if%>> ┣<%=Rsccc("Class")%></option>
<%
Set Rscccc = Conn.Execute("Select * From NewsClass Where PartID='"& Rsccc("NumberID") &"' Order By Classorder")
While Not Rscccc.Eof
%>
<option value="<%=Rscccc("NumberID")%>" <%if ClassStr=Rscccc("NumberID") then%>selected<%end if%>> ┣<%=Rscccc("Class")%></option>
<%
Rscccc.MoveNext
Wend
Rscccc.Close
Set Rscccc = Nothing
Rsccc.MoveNext
Wend
Rsccc.Close
Set Rsccc = Nothing
Rscc.MoveNext
Wend
Rscc.Close
Set Rscc = Nothing
rsc.movenext
wend
rsc.close
set rsc=nothing
%>
</select> <a href="NewsClass_Manage.asp">添加</a></td>
</tr>
<tr bgcolor="ffffff">
<td width='15%' height="25" align="right">新闻内容:</td>
<td height="25">
<%EditNumberID="WebMaster"%>
<!--#include file="../Edit/Edit.asp"-->
<br>
<script language="javascript">
document.write ('<iframe src="textbox.asp?Makking=News&ID=<%=ID%>" id="message" width="98%" height="250" align=left></iframe>')
frames.message.document.designMode = "On";
</script>
</td>
</tr>
</table>
<p>
<input type="hidden" name="body" value="">
<input name="B1" type="image" src="Images/refer.gif" width="36" height="21" border="0" OnClick="document.Userform.body.value = frames.message.document.body.innerHTML;">
<a href="javascript:history.go(-1)"><img src="Images/back.gif" width="36" height="21" border="0"></a></p>
</form></td>
</tr>
</table></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="6"></td>
</tr>
</table>
<%end select
Conn.Close
Set Conn = Nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?