📄 admin_addarticle.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="Admin_Check.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%= cfgTitle %></title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="Style.css" rel="stylesheet" type="text/css">
<%
Dim title
Dim Description
Dim Content
Dim btn
Dim TypeID
btn = "添加"
if request("action") = "save" then
Dim ContentID
if request("ContentID") = "" then
ContentID = -1
else
ContentID = request("ContentID")
end if
call creaters(rs,"select * from Article where ContentID=" & Clng(ContentID))
if rs.eof then rs.addnew
rs("username") = request.Cookies("user")("username")
rs("title") = request.Form("title")
rs("Content") = request.Form("Content")
rs("TypeID") = request.Form("TypeID")
rs("description") = request.Form("description")
rs("date") = date()
rs.update
call closers(rs)
call RedirToList()
elseif request("action") = "alter" then
call creaters(rs,"select * from Article where ContentID=" & request("ContentID"))
title = rs("title")
Content = rs("Content")
TypeID = rs("TypeID")
Description = rs("Description")
call closers(rs)
btn = "修改"
end if
Sub RedirToList()
%>
<script language="javascript">
alert("操作成功!");
window.location = "Admin_ArticleList.asp";
</script>
<%
End Sub
%>
</head>
<body>
<table width="613" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="613" height="29" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="613" height="29" align="center" valign="middle"><div align="center"><strong>文章管理</strong></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="164" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="21" height="8"></td>
<td width="551"></td>
<td width="41"></td>
</tr>
<tr>
<td height="156"></td>
<td valign="top">
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#C0E096">
<!--DWLayoutTable-->
<form name="frmUnit" action="Admin_AddArticle.asp?action=save&ContentID=<%= request("ContentID") %>" method="post">
<tr valign="middle" bgcolor="#F3F9EC">
<td width="136" height="23"><strong>文章标题:</strong></td>
<td width="375"><input name="Title" type="text" class="InputBox" id="Title" value="<%= Title %>" size="52" maxlength="50"></td>
</tr>
<tr valign="middle" bgcolor="#FFFFFF">
<td height="23"><strong>文章类别:</strong></td>
<td>
<select name="TypeID" class="InputBox" id="TypeID">
<%
call creaters(rs,"select * from Type where username='" & request.Cookies("user")("username") & "'")
while not rs.eof
%>
<option value="<%= rs("TypeID") %>"><%= rs("Description") %></option>
<%
rs.movenext
wend
call closers(rs)
%>
</select>
</td>
</tr>
<tr valign="middle" bgcolor="#F3F9EC">
<td height="23" bgcolor="#F3F9EC"><strong>文章概述(限200字符):</strong></td>
<td><textarea name="Description" cols="50" rows="3" class="InputBox" id="Description" maxlength="200"><%= Description %></textarea></td>
</tr>
<tr valign="middle" bgcolor="#FFFFFF">
<td height="23"><strong>文章内容:</strong></td>
<td height="23"><textarea name="Content" cols="50" rows="6" class="InputBox" id="Content"><%= Content %></textarea></td>
</tr>
<tr valign="middle" bgcolor="#F3F9EC">
<td height="23" colspan="2"><div align="center">
<input name="btnSubmit" type="button" class="InputBox" id="btnSubmit" value="<%= btn %>">
<input name="Submit2" type="reset" class="InputBox" value="重置">
</div></td>
</tr>
</form>
</table></td>
<td></td>
</tr>
</table></td>
</tr>
<tr>
<td height="12"></td>
</tr>
</table>
</body>
</html>
<script language="vbscript">
sub btnSubmit_onclick()
if frmUnit.TypeID.value = "" then
Msgbox "请先到“添加分类”进行分类添加。",VbCritical,"文章分类"
exit sub
end if
if frmUnit.Title.value = "" then
Msgbox "文章标题不允许为空.",VbCritical,"文章标题"
exit sub
end if
if frmUnit.Content.value = "" then
Msgbox "文章内容不允许为空.",VbCritical,"文章内容"
exit sub
end if
frmUnit.submit
end sub
</script>
<script language="javascript">
<% if request("action") = "alter" then %>
setSelectValue(frmUnit.TypeID,<%= TypeID %>);
<% End If %>
function setSelectValue(SelObj,valu) //设置一个列表框的值
{
var i;
for(i=0;i<SelObj.length;i++)
{
if(SelObj.options[i].value == valu)
{
SelObj.selectedIndex = i
return
}
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -