?? news.asp
字號(hào):
<!--#include file="gg/conn.asp"-->
<%
dim newtext,oldtext
IF Request("del")<>"" Then
Sql = "Delete From news Where id="&Request("del")
Conn.Execute(Sql)
Response.Redirect "gonggao.asp"
End IF
if Request("action")="edit" then
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from news where id="&request("id")
rs.open sql,conn,1,3
oldtext=request.form("text")
newtext=replace(oldtext,vbcrlf,"<br>")
if trim(request.form("title"))="" then
response.write "<script language=javascript>"
response.write "alert('請(qǐng)?zhí)顚憳?biāo)題');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
if trim(request.form("text"))="" then
response.write "<script language=javascript>"
response.write "alert('請(qǐng)?zhí)顚憙?nèi)容');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
rs("title")=trim(request("title"))
rs("text")=newtext
rs.Update
rs.Close
set rs=nothing
Response.Redirect "gonggao.asp"
end if
if Request("action")="add" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from news"
rs.open sql,conn,3,2
rs.addnew
if trim(request.form("title"))="" then
response.write "<script language=javascript>"
response.write "alert('請(qǐng)?zhí)顚憳?biāo)題');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
if trim(request.form("text"))="" then
response.write "<script language=javascript>"
response.write "alert('請(qǐng)?zhí)顚憙?nèi)容');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
oldtext=trim(request.form("text"))
newtext=replace(oldtext,vbcrlf,"<br>")
rs("title")=trim(request("title"))
rs("text")=newtext
rs.update
rs.close
response.redirect "gonggao.asp"
end if
%>
<html>
<head>
<title>更新公告</title>
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
<!--
.style1 {color: #000000}
input {
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
}
-->
</style>
</head>
<body>
<%
sql="select * from news order by id desc"
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,3
'公共翻頁模塊開始%>
<table width="600" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#006699">
<tr>
<td align="center" height="23"><b><font color="#FFFFFF">編輯公告</font></b></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<!--#include file=fpage/fpage.asp-->
<%
Dim RowCount
RowCount = 10 '每頁顯示的記錄條數(shù)
Call TurnPage(Rs,RowCount)
'公共翻頁模塊結(jié)束%>
</td>
</tr>
</table>
<table width="600" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#00659C" height="17">
<tr align="center">
<td width="179"><font color="#FFFFFF">標(biāo)題</font></td>
<td width="310"><font color="#FFFFFF">內(nèi)容</font></td>
<td width="95"><font color="#FFFFFF">操作</font></td>
</tr>
</table>
<table width="600" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
<%
If Not Rs.eof then
Do while Not Rs.eof and RowCount>0
%>
<tr>
<form action="gonggao.asp?action=edit" method="post">
<td width="177" bgcolor="#FFFFFF" align="center" >
<div align="center">
<input name="title" type="text" value="<%=rs("title")%>" size="26" class="text復(fù)制" maxlength="50">
<input name="id" type="hidden" id="id" value="<%=rs("id")%>">
</div>
</td>
<td width="314" bgcolor="#FFFFFF">
<div align="center">
<textarea name="text" cols="40" rows="4" class="text復(fù)制"><%=rs("text")%></textarea>
</div></td>
<td width="46" nowrap bgcolor="#FFFFFF">
<div align="center">
<input name="Submit2" type="submit" class="text復(fù)制" value="EDIT">
</div></td>
<td width="42" nowrap bgcolor="#FFFFFF">
<div align="center"><a href="gonggao.asp?del=<%=Rs("id")%>">刪除</a></div></td>
</form>
</tr><%
RowCount = RowCount - 1
Rs.MoveNext
Loop
End If
%>
</table>
<table width="60%" border="0" cellspacing="0" cellpadding="0" align="center" height="8">
<tr>
<td></td>
</tr>
</table>
<table width="60%" border="0" cellspacing="0" cellpadding="0" align="center" height="8">
<tr>
<td></td>
</tr>
</table>
<table width="600" border="0" cellspacing="1" cellpadding="6" align="center" bgcolor="#00659C">
<tr>
<td align="center"><b><font color="#FFFFFF">填加公告</font></b></td>
</tr>
</table>
<table width="600" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
<form action="gonggao.asp?action=add" method="post" name="form" >
<tr>
<td bgcolor="#FFFFFF" width="132">
<p align="right" class="style1">標(biāo)題:
</td>
<td bgcolor="#FFFFFF" width="607">
<input name="title" type="text" class="text復(fù)制" size="30">
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" width="132" height="58">
<div align="right" class="style1"> 內(nèi)容:</div>
</td>
<td bgcolor="#FFFFFF" width="607" valign="middle" height="58">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70%" height="59">
<textarea name="text" class="text復(fù)制" id="password" cols="50" rows="4"></textarea>
</td>
<td width="30%" height="59"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" width="132">
<div align="right"></div></td>
<td bgcolor="#FFFFFF" width="607">
<input name="Submit" type="submit" class="text復(fù)制" value=" 增 加 ">
<input name="Submit1" type="reset" class="text復(fù)制" value=" 重 設(shè) ">
</td>
</tr>
</form>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -