前言
本课题的主要任务是建造一新闻自动化管理网站,整个课题的设计工作分三步进行,首先是相关资料的收集和与相关人员的沟通和交流,随后是网站的实质性设计,最后是网站的测试工作。整个工作从2006年2月中旬开始,至2006年4月基本结束。网站的图片资料及其各种新闻信息等资料由网络提供,网站的网页主要由Dreamwear MX结合HTML语言设计,其中后台数据库为Microsoft Acess 2000,网页的交互用Javascript实现,ASP网页和数据库的链接采用VBScript脚本语言,整个系统以Windows 2000+IIS作为Web服务器。
系统结构
模块展示
系统首页实现方法:
界面如图所示:
会员登录页面
管理员登录页面示例
管理系统首页页面
管理系统首页页面示例
添加文章页面
添加文章页面示例:
部分核心代码展示:
主要ASP程序如下:
<title>添 加 文 章</title>
定义变量,连接数据库,并从数据库的ANclass表中检索所有属性。
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from ANclass order by Nclassid asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
function changelocation(locationid)
{document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{ if (subcat[i][1] == locationid) document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);} } }
<center><p><b>添 加 文 章</b></td>
<td width="15%" align="right" valign="top" height="20"><b>文章类型:</b></td>
<% sql = "select * from Aclass"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
%>
<select name="classid" onChange="changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("classid"))%>"><%=trim(rs("class"))%></option>
<% dim selclass
selclass=rs("classid")
rs.movenext
do while not rs.eof
%>
<option value="<%=trim(rs("classid"))%>"><%=trim(rs("class"))%></option>
<%rs.movenext
loop
end if
rs.close%>
</select>
<select name="Nclassid">
<%sql="select * from ANclass where classid="&selclass
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("NclassID")%>"><%=rs("Nclass")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("NclassID")%>"><%=rs("Nclass")%></option>
<% rs.movenext
loop
end if
rs.close
set rs = nothing
conn.Close
set conn = nothing
%>
</select>**
</td></tr>
<tr>
<td width="15%" align="right" height="30"><b>文章标题:</b></td>
<td width="85%" height="30"><input type="text" name="txttitle" size="70"
class="smallinput" maxlength="100"></td>
</tr>
<tr>
<td width="15%" align="right" valign="top"><b>文章内容:</b></td>
<td width="85%"><textarea rows="15" name="txtcontent" cols="60" class="smallarea"></textarea></td>
</tr>
<tr>
<td width="15%" align="right" height="30"><b>相关文章:</b></td>
<td width="85%" height="30"><input type="text" name="key" size="70"
class="smallinput" maxlength="100"></td>
</tr>
<tr>
<td width="15%" align="right" height="30"><b>作者:</b></td>
<td width="85%" height="30"><input type="text"
这篇内容已经上传到资源库中,作为练手项目真的太合适了,希望对你有帮助,你的点赞就是我最大的动力