• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    用ASP構建你的網站新聞發布(三)

    發布: 2007-7-14 19:37 | 作者: 佚名    | 來源: 網絡轉載     | 查看: 8次 | 進入軟件測試論壇討論

    領測軟件測試網
    (三)把新聞代碼插入你的頁面
      最好的新聞發布,當然是為網站本身定做的,那樣才能與主頁風格一致,但如此一來,新聞發布系統有缺乏了通用性了,不能移值到別的網站上使用,有得必有失,在這個基礎上關鍵是找一個平行點。綜合來考濾,最好的做法是與頁面分離,那樣就可以不影響網頁的外觀,而也能達到很好的效果,在使用新聞的網頁上我們可以通過放置一條這樣的script語句來調用新聞代碼
     。約cript language="JavaScript/" target="_blank">JavaScript"
    src="http//xxx.com.cn/special/linux/lnews/autoup.asp">
      大家可以到這里看看效果
      現在請大家看看autoup.asp的代碼。
    <% @language="vbscript" %>
    <!--#include Virtual="/news/data/data.inc"-->
    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql="select * from data Order by news_id Desc"
    rs.open sql,conn,3,2
    if rs.bof then
    response.end
    end if


    dispmess="<table border=0 width=100% cellpadding=0>"

    rs.movefirst
    disp=""
    count=0

    disp="<tr><td width=100% ><b>廣州市場</b></td></tr>"

    do while not rs.eof

    廣州市場

    if Cint(rs("news_class"))=3 then

    disp=disp&"<tr><td width=100% ><a href=http://www.aaaaa.com.cn/news/read.asp?news_id="&rs("news_id")&" target=_blank>>>"&rs("news_title")&"</a>(<font size=1>"&rs("news_year")&"-"&rs("news_month")&"-"&rs("news_day")&" "&rs("news_time")&"</font>)</td></tr>"
    if count>=10 then clng(application("disp_1"))-1 then
    exit do
    end if
    count=count+1


    end i r> rs.movenext

    loop
    disp=disp&"<tr><td width=100% align=right>【更多新聞...】 </td></tr>"
    dispmess=dispmess&disp




    rs.movefirst
    disp=""
    count=0

    disp="<tr><td width=100% ><b>市場風云</b></td></tr>"

    do while not rs.eof

    市場風云

    if Cint(rs("news_class"))=1 then

    disp=disp&"<tr><td width=100% ><a href=http://www.aaaaa.com.cn/news/read.asp?news_id="&rs("news_id")&" target=_blank>>>"&rs("news_title")&"</a>(<font size=1>"&rs("news_year")&"-"&rs("news_month")&"-"&rs("news_day")&" "&rs("news_time")&"</font>)</td></tr>"
    if count>=10 then clng(application("disp_2"))-1 then
    exit do
    end if
    count=count+1


    end if
    rs.movenext

    loop
    disp=disp&"<tr><td width=100% align=right>【更多新聞...】 </td></tr>"
    dispmess=dispmess&disp



    rs.movefirst
    disp=""
    count=0
    disp="<tr><td width=100% ><b>IT新聞</b></td></tr>"

    do while not rs.eof
    IT新聞
    if Cint(rs("news_class"))=2 then

    disp=disp&"<tr><td width=100% ><a href=http://www.aaaaa.com.cn/news/read.asp?news_id="&rs("news_id")&" target=_blank>>>"&rs("news_title")&"</a>(<font size=1>"&rs("news_year")&"-"&rs("news_month")&"-"&rs("news_day")&" "&rs("news_time")&"</font>)</td></tr>"
    if count>=50 then clng(application("disp_3"))-1 then
    exit do
    end if
    count=count+1



    end if
    rs.movenext
    loop
    disp=disp&"<tr><td width=100% align=right>【更多新聞...】 </td></tr>"
    dispmess=dispmess&disp



    dispmess=dispmess&"</table>"

    dispmess="document.write("&dispmess&")"


    %>
    <%=dispmess%>
      通過定制這段代碼,就能制作出符合您要求的網頁顯示格式。
      添加,刪除,顯示都講解完了,最后一項,就是把新聞的詳細內容顯示出來。
      當用戶點擊新聞標題,就打開disp.asp文件,同時使用GET這種方式來把參數傳遞過去,我們看看disp.asp的文件內容
    <% @language="vbscript" %>
    <!--#include Virtual="/news/data/data.inc"-->
    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql="select * from data where Cstr(news_id)="&Cstr(request.querystring("news_id"))&""
    rs.open sql,conn,3,2
    %>
    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    </head>

    <body topmargin="8" leftmargin="8">
    <div align="center"><center>

    <table border="0" width="600" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%"></td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#E6E6E6"><table border="0" width="100%" cellpadding="0">
    <tr>
    <td width="100%" bgcolor="#D2E8FF"><p align="center"><b><%=rs("news_title")%></b></td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#FBFDFF"><table border="0" width="100%" cellpadding="0">
    <tr>
    <td width="100%"><p align="right">(update:<%=rs("news_year")%>-<%=rs("news_month")%>-<%=rs("news_day")%> <%=rs("news_time")%>) </td>
    </tr>
    <tr>
    <td width="100%"><p align="center"><%
    if rs("news_pic")<>"" then
    %> <img src="<%=rs("news_pic")%>"> <%
    end if
    %> </td>
    </tr>
    <tr>
    <td width="100%"><div align="center"><center><table border="0" width="90%" cellpadding="0">
    <tr>
    <td width="100%"><%=rs("news_comment")%>
    </td>
    </tr>
    </table>
    </center></div></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#D2E8FF"><p align="center"><a href="javascript:window.close()">關閉窗口</td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%"></td>
    </tr>
    <tr>
    <td width="100%"></td>
    </tr>
    </table>
    </center></div></a>
    </body>
    </html>
      至此,新聞發布系統已能投入使用,試試看,是不是很方便,很容易就能增添每天的新聞內容了。下一節。我們將為新聞發布系統加入(標題/全文)檢索功能,把它制作得更為完美

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>