首页/技术开发/内容

用文本+ASP打造新闻公布系统(4)新闻删除

技术开发2024-02-19 阅读()
"
end if
next
mytext.close
%>
<script language="javascript">
alert("删除成功");
location.href =("news_admin1.asp");
</script>
---------------
news_view.asp
<% Response.Expires=0
dim myid,myfso,myread,mytext1
myid=request.querystring("id")

if len(myid)=0 then
Response.Write "没有该新闻"
Response.End
end if

set myfso=createobject("scripting.filesystemobject")
set myread=myfso.opentextfile(server.mappath("./news_content/"&myid&".txt"),1,0)
if myread.atendofstream then
Response.Write "没有新闻内容"
Response.End
else
mytext1=myread.readall '#######打开对应的新闻内容文件,并读取用变量存储


function htmlencode2(str)'###########字符处理函数
dim result
dim l
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case chr(34)
result=result+""""
case "&"
result=result+"&"
case chr(13)
result=result+"<br>"
case " "
result=result+" "
case chr(9)
result=result+" "
case chr(32)
result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
case else
result=result+mid(str,i,1)
end select
next
htmlencode2=result
end function



myread.close
end if

dim mytext2,myread2
set myread2=myfso.opentextfile(server.mappath("./new_list.asp"),1,0)

if myread2.atendofstream then
Response.Write "没有新闻内容"
Response.End
else
mytext2=myread2.readall
myread2.close
dim listarray,i,h
listarray=split(mytext2,"(北联网教程,专业提供视频软件下载)

第1页  第2页  第3页  第4页  第5页  第6页 

……

相关阅读