admin_addinfo.asp

来自「购物系统时尚版.强大的后台文章编辑器的功能」· ASP 代码 · 共 120 行

ASP
120
字号
<!--#include file="chk.asp"-->
<!--#include file="db_conn.asp"-->
<!--#include file="../my_lib/my_request.asp"-->
<%
action=my_request("action",0)
if action="save" then
call saveinfo()
else
%>
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css" rel=stylesheet type=text/css>
<title>信息内容添加</title>
<script language="javascript">
<!--
function checkdata()
{
if (document.form1.viewhtml.checked == true)
	{
	  alert("对不起,请取消“查看HTML源代码”后再添加!")
	  document.form1.viewhtml.focus()
	  return false
	 }
}
//-->
</script>
<script src="edit.js" type="text/javascript"></script>
</head>

<body>
<!--#include file="TopManu.asp"-->
<div align="center">
    <form action="admin_addinfo.asp" method="post" name="form1" onsubmit="return checkdata();">
    <table border="0" width="100%" id="table1" cellspacing="0" style="border-collapse: collapse" cellpadding="0">
	 <tr>
		<td background="image/admintoptdbg.gif">
		<p align="left">
		<img border="0" src="image/title_arrow.bmp" width="17" height="27" align="absmiddle"><font color="#808080"><b>信息发布</b></font></td>
	 </tr>
    </table>
    	<table border="1" width="100%" id="table1" cellspacing="0" style="border:1px solid #CCCCCC; border-collapse: collapse; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px" bordercolor="#EFEFEF" cellpadding="4" bgcolor="#F6F6F6">
		<tr>
			<td width="191" align="right">标题:</td>
			<td width="559">
			<input type="text" name="title" size="39" maxlength="50"></td>
		</tr>
		<tr>
			<td width="191" align="right">类别:</td>
			<td width="559"><select size="1" name="flag">
			<option selected value="">请选择...</option>
			<option value="1">网站动态</option>
			<option value="2">网站公告</option>
			</select></td>
		</tr>
		<tr>
			<td width="191" align="right">内容:</td>
			<td width="559">
<!--#include file="eokedit.asp"-->
<script language="javascript">
document.write ('<iframe src="news_textbox.asp" id="message" width="450" height="250"></iframe>')
frames.message.document.designMode = "On";
</script></td>
		</tr>
		<tr>
			<td width="191" align="right">编辑:</td>
			<td width="559">
			<input type="text" name="editor" size="20" maxlength="20">
			<input type="hidden" name="action" value="save"></td>
		</tr>
		<tr>
			<td width="191">
			 </td>
			<td width="556">
			<p align="left"><font color="#FF0000">注意:添加公告时,请不要上传图片。</font></td>
		</tr>
		<tr>
			<td colspan="2">
			<p align="center"><input type="submit" value="提交" name="B1" onclick="document.form1.Content.value = frames.message.document.body.innerHTML;">&nbsp; <input type="reset" value="重置" name="B2"><input type="hidden" name="Content" value></td>
		</tr>
	</table>
	</form>
</div>
<table border="0" width="760" id="table3" cellspacing="0" cellpadding="0" align=center>
	<tr>
		<td align=right><input TYPE="button" VALUE="刷新本页" ONCLICK="location.reload()"> </td>
	</tr>
</table>
</body>

</html>
<%
end if
sub saveinfo()
title=my_request("title",0)
flag=my_request("flag",1)
content=my_request("content",0)
editor=my_request("editor",0)
if title="" or flag="" or content="" or editor="" then
response.write"<SCRIPT language=JavaScript>alert('信息未填写完整!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
else
sql="insert into info_list (title,flag,content,editor,addtime) values('"&title&"',"&flag&",'"&content&"','"&editor&"','"&now()&"')"
conn.execute(sql)
conn.close
set conn=nothing
select case flag
case 1
response.redirect "info_manage.asp?flag=1"
case 2
response.redirect "info_manage.asp?flag=2"
case else
response.redirect "admin_addinfo.asp"
end select
end if
end sub
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?