📄 editarticle.asp
字号:
<!--#include file="head.asp" -->
<script src="Ubbcode.js"></script>
<%
IF Request("action") = "edit" then
id = Request.Form("id")
txttitle = Strcheck(Request.Form("txttitle"))
Intime = Request.Form("year1")&"-"&Request.Form("month1")&"-"&Request.Form("day1")
txtcontent = Strcheck(Request.Form("txtcontent"))
key = Strcheck(Request.Form("key"))
writer = Strcheck(Request.Form("writer"))
writefrom = Strcheck(Request.Form("writefrom"))
classid = Request.Form("classid")
Nclassid = Request.Form("Nclassid")
Sql = "Update article set content = "& txtcontent &",title = "& txttitle &",Nclassid = "
Sql = Sql & Nclassid &",classid = "& classid &",Nkey = "& key &",writer = "& writer &",writefrom = "
Sql = Sql & writefrom &",dateandtime = '"& Intime &"' where articleid = " & id
conn.execute(Sql)
Response.Write "<script>alert(""修改成功"");location.href=""adminedit.asp"";</script>"
Response.End
end if
%>
<form method="POST" action="?action=edit" name="myform" onSubmit="return check();">
<input type="hidden" name="id" value="<%=request("id")%>">
<table width="100%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<tr valign="middle">
<td colspan="2" align="center" bgcolor="#FFCC00" height="25">修 改 文
章</td>
</tr>
<tr>
<td width="15%" align="left" valign="middle" height="20">文章类型:</td>
<td width="85%">
<select class="smallSel" name="classid" size="1">
<%
dim rs,sql,sel
dim classid,Nclassid
classid=request("classid")
Nclassid=request("Nclassid")
set rs=server.createobject("adodb.recordset")
sql="select * from Aclass"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "Not record."
else
do while not rs.eof
if classid=cstr(rs("classid")) then
sel="selected"
else
sel=""
end if
response.write "<option " & sel & " value='"+CStr(rs("classID"))+"' name=classid>"+rs("class")+"</option>"+chr(13)+chr(10)
rs.movenext
loop
end if
rs.close
%>
</select>
选择分类:
<select name="Nclassid" size="1">
<%
sql="select * from ANclass"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "Not record."
else
do while not rs.eof
if Nclassid=cstr(rs("Nclassid")) then
sel="selected"
else
sel=""
end if
response.write "<option " & sel & " value='" + Cstr(rs("Nclassid")) + "'>" + rs("Nclass") + "</option>"
rs.MoveNext
Loop
end if
rs.close
%>
</select>
** </td>
</tr>
<%
sql="select * from article where articleid="&request("id")
rs.open sql,conn,1,1
%>
<tr>
<td width="15%" align="left" height="30" valign="middle">文章标题:</td>
<td width="85%" height="30">
<input type="text" name="txttitle" size="70"
class="smallinput" maxlength="100" value="<%=rs("title")%>">
</td>
</tr>
<tr>
<td width="15%" align="left" height="30" valign="middle">UBB 标签:</td>
<td width="85%" height="30">
<!--#include file="getUbb.asp" -->
</td>
</tr>
<tr>
<td width="15%" align="left" valign="middle">修改日期:</td>
<td width="85%">
<select name="year1">
<option value="<%=year(rs("dateandtime"))%>" selected><%=year(rs("dateandtime"))%></option>
<%
for i=2001 to 2005
response.write "<option value='"&i&"'>"&i&"</option>"
next
%>
</select>
年
<select name="month1">
<option value="<%=month(rs("dateandtime"))%>" selected><%=month(rs("dateandtime"))%></option>
<%
for i=1 to 12
response.write "<option value='"&i&"'>"&i&"</option>"
next
%>
</select>
月
<select name="day1">
<option value="<%=day(rs("dateandtime"))%>" selected><%=day(rs("dateandtime"))%></option>
<%
for i=1 to 31
response.write "<option value='"&i&"'>"&i&"</option>"
next
%>
</select>
日 </td>
</tr>
<tr>
<td width="15%" align="left" valign="middle">文章内容:</td>
<td width="85%">
<textarea rows="15" name="txtcontent" cols="60" class="smallarea">
<%
content=replace(rs("content"),"<BR>",chr(13))
content=replace(content," "," ")
response.write content
%>
</textarea>
</td>
</tr>
<tr>
<td width="15%" align="left" height="30" valign="middle">相关文章:</td>
<td width="85%" height="30">
<input type="text" name="key" size="70"
class="smallinput" maxlength="100" value=<%=rs("Nkey")%>>
(即关键字) </td>
</tr>
<tr>
<td width="15%" align="left" height="30" valign="middle">作 者:</td>
<td width="85%" height="30">
<input type="text" name="writer" size="70"
class="smallinput" maxlength="100" value=<%=rs("writer")%>>
</td>
</tr>
<tr>
<td width="15%" align="left" height="30" valign="middle">来 源:</td>
<td width="85%" height="30">
<input type="text" name="writefrom" size="70"
class="smallinput" maxlength="100" value=<%=rs("writefrom")%>>
</td>
</tr>
<tr>
<td width="15%" align="left" height="30" valign="middle">录入人:</td>
<td width="85%" height="30"><%=rs("author")%></td>
</tr>
<tr>
<td colspan="2" align="center" height="30">
<input type="submit" value=" 修 改 "
name="cmdok" class="buttonface">
<input type="reset" value=" 清 除 "
name="cmdcancel" class="buttonface">
</td>
</tr>
</table>
</form>
<%
set rs=nothing
conn.close
set conn=nothing
%>
<script language="JavaScript">
function check(){
if (myform.txttitle.value ==""){
alert("请输入文章标题");
myform.txttitle.focus();
return false;
}
if (myform.txtcontent.value ==""){
alert("请输入文章内容");
myform.txtcontent.focus();
return false;
}
return true;
}
</script>
<!--#include file="copy.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -