📄 note.asp
字号:
<!--#include file="conn.asp"-->
<%
action=request.QueryString("action")
if action="save" then
title=request("title")
content=request("content")
content=server.htmlencode(content)
content=replace(content," "," ")
content=replace(content,chr(13)&chr(10),"<br>")
if user<>"" or content<>"" then
sql="insert into [note](note_title,note_content) values('"&title&"','"&content&"')"
conn.execute(sql)
response.write "<script LANGUAGE='javascript'>alert('纪录成功!');</script>"
end if
end if
if action="del" then
id=request("id")
sql="delete from [note] where note_id="&id&""
conn.execute(sql)
end if
%>
<html>
<head>
<link href=css.css rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<div align="center">
<table width="700" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="40" height="23"> </td>
<td width="582"> </td>
<td width="78"> </td>
</tr>
<tr>
<td height="329"> </td>
<td valign="top"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#66CCFF">
<!--DWLayoutTable-->
<tr>
<td height="24" colspan="2" valign="middle" bgcolor="#00FFFF"> <div align="center"><strong>网站记事本</strong></div></td>
</tr>
<%
page=request.querystring("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)
set rs=server.createobject("adodb.recordset")
sql="select * from [note] order by note_time desc"
rs.open sql,conn,1,1
if rs.eof then
%>
<TR>
<td width="280" >暂无记事纪录!</td>
</TR>
<%else
rs.pagesize=4
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
rs.cachesize=rs.pagesize
i=0
dim note_id(),note_title(),note_content(),note_time()
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve note_id(i),note_title(i),note_content(i),note_time(i)
note_id(i)=rs("note_id")
note_title(i)=rs("note_title")
note_content(i)=rs("note_content")
note_time(i)=rs("note_time")
rs.movenext
loop
rs.close
for i=1 to ubound(note_id)
%>
<tr>
<td height="115" colspan="2" valign="top" bgcolor="#FFFFFF"> <p align="left">标题:<strong><font color="#FF0000"><%=note_title(i)%></font></strong>
<%if session("admin_name")<>"" then%>
<a href="note.asp?action=del&id=<%=note_id(i)%>"><font color="#0000FF">【删除】</font></a>
<%end if%>
<br>
时间:<%=note_time(i)%><br>
内容: </p>
<p align="left"><%=note_content(i)%></p>
<p align="left"> </p>
<p align="left"></p></td>
</tr>
<%next
end if%>
<tr valign="middle" bgcolor="#00FFFF">
<td height="20" colspan="2"> <div align="right">第 <%=page%> 页 共 <%=totalpage%>
页
<%if page>1 then%>
<a href="note.asp?page=<%=page-1%>">上一页</a>
<%end if%>
<%if page<totalpage then%>
<a href="note.asp?page=<%=page+1%>">下一页</a>
<%end if%>
</div></td>
</tr>
<%if session("admin_name")<>"" then%>
<tr>
<td height="120" colspan="2" valign="top" bgcolor="#FFFFFF"><form name="form1" method="post" action="note.asp?action=save">
<table width="100%" height="131" border="0">
<tr>
<td width="13%" height="21"> </td>
<td width="13%">标题:</td>
<td width="48%"><input name="title" type="text" size="50" maxlength="50"></td>
<td width="26%"> </td>
</tr>
<tr>
<td height="63"> </td>
<td>内容:</td>
<td><textarea name="content" cols="60" rows="10"></textarea></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="提交" onClick="return check()"></td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
<%end if%>
<tr>
<td height="24" colspan="2" valign="middle" bgcolor="#00FFFF"> <div align="center">版权所有:中国人民大学二手交易网</div></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="29"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</body>
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
if(checkspace(document.form1.user.value)) {
document.form1.user.focus();
alert("标题不能为空,请重新输入!");
return false;
}
if(checkspace(document.form1.content.value)) {
document.form1.content.focus();
alert("内容不能为空,请重新输入!");
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</script>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -