人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

用ASP構建你的網站新聞公布(3)

用ASP構建你的網站新聞公布(3)

更新時間:2022-08-19 文章作者:未知 信息來源:網絡 閱讀次數:

(三)把新聞代碼插入你的頁面
  最好的新聞發布,當然是為網站本身定做的,那樣才能與主頁風格一致,但如此一來,新聞發布系統有缺乏了通用性了,不能移值到別的網站上使用,有得必有失,在這個基礎上關鍵是找一個平行點。綜合來考濾,最好的做法是與頁面分離,那樣就可以不影響網頁的外觀,而也能達到很好的效果,在使用新聞的網頁上我們可以通過放置一條這樣的script語句來調用新聞代碼
  <script 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>
  至此,新聞發布系統已能投入使用,試試看,是不是很方便,很容易就能增添每天的新聞內容了。下一節。我們將為新聞發布系統加入(標題/全文)檢索功能,把它制作得更為完美

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 柘荣县| 泰州市| 新巴尔虎右旗| 泰安市| 金阳县| 河南省| 北辰区| 林芝县| 亚东县| 邮箱| 沙雅县| 三穗县| 南涧| 苍山县| 疏勒县| 望江县| 怀柔区| 宿松县| 宣化县| 广南县| 安丘市| 长白| 赫章县| 甘泉县| 长宁区| 和政县| 万全县| 肥东县| 出国| 惠州市| 中山市| 绍兴县| 类乌齐县| 阜平县| 海林市| 衢州市| 迁西县| 同仁县| 错那县| 潜江市| 文成县|