NewsRhzhi | 先创资讯 | 旧版入口
rhzhi.net
网站首页 | NewsRhzhi | 先创资讯 | 操作系统 | 工具软件 | 办公软件 | 网站设计 | 组网专栏 | 平面设计 | 多 媒 体 | 程序开发 | 硬件资料 | 聊天软件
您现在的位置: 先创网 >> 程序开发 >> ASP >> 文章正文
构建你的网站新闻自动发布系统之四
itbulo.com
2005-6-28文/未知
    

程序处理完毕后,重新导向delete.asp这个asp文件,用以刷新新闻数据库内的显
示,那么每提交一条新闻资料,我们马上可以看见执行的结果是否成功了。   
以下是delete.asp的文件内容。   
《% @language="vbscript" %》   
《%   
response.buffer=true   
Response.Expires=0   
  
%》   
《!--#include Virtual="/news/data/data.inc"--》   
《%   
  
Set rs = Server.CreateObject("ADODB.Recordset")   
sql="select * from data order by news_class ASC,news_id Desc"   
'rs.PageSize=100   
rs.open sql,conn,3,2   
  
  
%》   
《html》   
  
《head》   
《meta http-equiv="Content-Type" content="text/html;
charset=gb2312"》   
《title》新闻数据库中所存的资料《/title》   
《meta name="GENERATOR" content="Microsoft FrontPage 3.0"》   
《style TYPE="text/css"》   
《!--   
lh22px {font-size:12px;line-height:22px;font-family:宋体}   
a { text-decoration: none}   
body {line-height:18px;font-size:9pt;font-family:宋体}   
td {line-height:18px;font-size:9pt;font-family:宋体}   
a:hover {color:#FF0000;text-decoration:none}   
--》   
《/style》   
《meta name="Microsoft Border" content="none"》   
《/head》   
  
《body》   
  
《form method="POST" action="delete.asp"》   
《table border="0" width="750" cellpadding="0"》   
《tr》   
《td width="750" bgcolor="#EBEBEB" colspan="2"》《div align="center"》
《center》《p》《font   
size="3"》《strong》新闻数据库中所存的资料《/strong》《/font》《/td》   
《/tr》   
《%   
do while not rs.eof   
%》   
《tr align="center"》   
《td width="112" bgcolor="#EBEBEB"》是否删除:《%if rs("news_delete")=-
1 then%》   
《input type="checkbox" name="《%=rs("news_id")%》"   
value="ON"》   
《%else%》   
《input type="checkbox" name="《%=rs("news_id")%》"   
value="OFF"》   
《%end if%》   
《/td》   
《td width="638" bgcolor="#FAFAFA" align="left"》《%if rs
("news_class")=1 then%》   
《font color=red》市场风云《/font》   
《%end if%》   
《%if rs("news_class")=2 then%》   
《font color=red》IT新闻《/font》   
《%end if%》   
《%if rs("news_class")=3 then%》   
《font color=red》广州市场《/font》   
《%end if%》   
《%if rs("news_class")=4 then%》   
《font color=red》保 留《/font》   
《%end if%》   
《%if rs("news_class")=5 then%》   
《font color=red》保 留《/font》   
《%end if%》   
《%=rs("news_title")%》《/td》   
《/tr》   
《%   
rs.movenext   
loop   
%》   
《tr align="center"》   
《td width="100%" colspan="2" bgcolor="#EBEBEB"》《center》《p》
《input   
type="submit" value="提 交" name="B1"》      《input
type="reset"   
value="清 除" name="B2"》《/td》   
《/tr》   
《/table》   
《/form》   
《/body》   
《/html》   
《%   
  
if Request.ServerVariables("REQUEST_METHOD")="POST" then   
  
if not rs.bof then   
rs.movefirst   
end if   
do while not rs.eof   
n=trim(cstr(rs("news_id")))   
if request.form(n)="OFF" then   
rs.delete   
rs.update   
end if   
rs.movenext   
loop   
response.redirect "delete.asp"   
  
rs.close   
end if   
response.flush   
%》   
  delete.asp也是一个构成webadmin.htm的管理页面的asp文件,它负责新闻数据
库的标题显示,以便让您知道现在库用有些什么新闻。同时可以通过它来删除新闻记
录,那么我们在使用新闻的主页里反应出来的结果就是动态的了,新闻可以在线添加
和删除。令外一个附加的asp程序   
set_diap.asp是用于控制每一类新闻在主页上显示的数目的,它主要使用
application对象来设定。   
  
《% @language="vbscript" %》   
《%   
response.buffer=true   
Response.Expires=0   
  
application("disp_1")=request.form("disp_1")   
application("disp_2")=request.form("disp_2")   
application("disp_3")=request.form("disp_3")   
application("disp_4")=request.form("disp_4")   
application("disp_5")=request.form("disp_5")     
  
response.redirect "delete.asp"   

%》   
  
  完成了上面的程序,我们的新闻发布系统就可以在线添加和删除,设置显示等的
功能来,需要加上搜寻功能,也可以在这个基础上加上。下一节我们来分析,如何;
令新闻代码嵌入不同的网页,实现真正的在线新闻功能。 

 

打印此页 投稿与建议 返回顶部
栏 目 索 引
软件应用 SOFTWARE
Win XP | NT/2003
Win2000 | DOS/Win9x
PowerPoint | Office
Excel | Word
网络软件 | 实用软件
媒体软件 | 系统软件
常用软件 | 办公软件
聊天软件 | 网络安全
新软试用 | Vista
设计在线 DESIGN
Dreamweaver | 3DMax
Photoshop | Flash
平面设计 | 网页设计
多 媒 体 | 精品画廊
精彩专区 SPECIAL
Q Q 专区 | 热门专题
组网玩网 | 程序开发
应用集锦 |

没有任何图片文章
相关文章
关于我们 - 联系方式 - 合作伙伴 - 网站大事记 - 网站地图 - 我要投稿
Copyright ©1997-2008 先创网 All Rights Reserved.
先创科技 版权所有