用文本+ASP打造新聞發布系統(五)新聞修改

來源:互聯網
上載者:User
‘#######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:



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.