当前位置:编程学习 > asp >>

用文本+ASP打造新闻发布系统(五)新闻修改

答案:‘#######news_update.asp
<!--#include file="news_session.asp"-->

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function client_onblur(ii) {
  server=eval("form1.server"+ii)
  if(server.value==""){
    client=eval("form1.client"+ii)
    clientvalue=client.value+""
    varlen=clientvalue.length
    a=clientvalue.lastIndexOf('\\')
    clientvalue=clientvalue.substring(a+1)
    //alert(clientvalue);
    server.value=clientvalue
  }
}
function form1_onsubmit() {
  for(i=1;i<1;i++){
    client=eval("form1.client"+i)
    server=eval("form1.server"+i)
    if(client.value!="" && server.value==""){alert("上传后的文件名不能空!");server.focus();return false}
  }
}

//-->
</SCRIPT>
<% dim myid
myid=Request.QueryString ("id")
if len(myid)=0 then
Response.Write "没有该新闻"
Response.End
end if

    dim myfso,myread,mytext,newscontent
        '#######打开对应的新闻内容文件,并读取用变量存储
    set myfso=createobject("scripting.filesystemobject")
    if  myfso.FileExists (server.mappath("./news_content/"&myid&".txt")) then
        set myread=myfso.opentextfile(server.mappath("./news_content/"&myid&".txt"),1,0)
         
           newscontent=myread.readall
             myread.close  
           newscontent=replace(newscontent,"<br>",chr(13))
           newscontent=replace(newscontent," "," ")
           newscontent=replace(newscontent," ",chr(32))
           newscontent=replace(newscontent,"'' ",chr(34))
          
   else
     Response.Write "该新闻已被删除"
     Response.End
   end if
    
    dim mytext2,myread2  '#######打开新闻列表文件
    set myread2=myfso.opentextfile(server.mappath("./new_list.asp"),1,0)
  if  myread2.atendofstream then
     Response.Write "没有新闻内容"
     Response.End
   end if

     mytext2=myread2.readall
     dim listarray
     listarray=split(mytext2,"|")     '#########读取记录并以#分割成listarray数组
     dim count,sf,i,title,src
         count=ubound(listarray)
      for i=0 to count      '###########根据ID找到该新闻并用变量存储给新闻的标题
            sf=split(listarray(i),",")
             if right(sf(0),7)=right(myid,7) then
             title=sf(1)
             src=sf(3)
             exit for
            end if
       next
  

  
%>

<head>
<style>
td {font-size:9pt}
INPUT.buttonface {
    BACKGROUND-COLOR: #0079F2; BORDER-BOTTOM: #333333 1px outset; BORDER-LEFT: #333333 1px outset; BORDER-RIGHT: #ffffff 1px outset; BORDER-TOP: #ffffff 1px inset; COLOR: black; FONT-SIZE: 9pta {  color: #000000; text-decoration: none}

.text {font-size:11pt}
INPUT.buttonface2 {
    BACKGROUND-COLOR: #EDF0F5;  COLOR: black; FONT-SIZE: 9pta {  color: #000000; text-decoration: none}
a:hover {  color: white; text-decoration: underline overline; background: #007EBB}
.text {font-size:11pt}

</style>
</head>

<body bgcolor=#EDF0F5 topmargin=10 marginheight=5 leftmargin=4 marginwidth=0>

<form method="POST" action="news_updateing.asp" name="form1" enctype="multipart/form-data"  onsubmit="return form1_onsubmit()">
  <div align="left">

    <table border="1" width="752" height="240" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="2" height="12" align="center" width="800" style="font-size:12pt"><strong>新闻发布系统后台管理--新闻修改</strong></td>
      </tr>
      <tr>
        <td width="119" height="12" style="font-size:9pt">新闻标题</td>
        <td width="675" height="12">
          <input type="text" name="newtitle" size="94" value="<%=title%>" class="buttonface2 ">
        </td>
      </tr>
      <tr>
        <td width="119" height="213" style="font-size:9pt">
          新<br>
          闻<br>
          内<br>
          容</td>
        <td width="675" height="213">
          <textarea rows="14" name="newcontent" cols="93"  style="BACKGROUND-COLOR: #EDF0F5"><%=newscontent%></textarea>
          <br>
        </td>
      </tr>
      <tr>
        <td width="119" height="4" style="font-size:9pt">新闻来源</td>
  &nbs

上一个:用文本+ASP打造新闻发布系统(四)新闻删除/新闻删除
下一个:用文本+ASP打造新闻发布系统/图片上传(不是我写的)upload.inc

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,