【正文】
讀取參數(shù) page,表示當(dāng)前的頁碼,使用 CLng將其轉(zhuǎn)換為長整型 Page = CLng(Request(Page)) 39。/td/tr/table Else 39。 ORDER BY Posttime DESC End If End If sql,conn,1,1 39。 And amp。 ORDER BY Posttime DESC Else sql = SELECT * FROM News WHERE CateId= amp。 ORDER BY Posttime DESC End If Else If sql_where = then sql = SELECT * FROM News WHERE CateId= amp。根據(jù)參數(shù) iflag和 sql_where變量設(shè)置 SQL語句,讀取新聞數(shù)據(jù) If iflag = Then If sql_where = Then sql = SELECT * FROM News ORDER BY Posttime DESC Else sql = SELECT * FROM News WHERE amp。FONTSIZE: 9pt39。39。 39。 amp。font color=red用戶管理 /font/a sql_where = Else 39。font color=red類別管理 /font/a a href=39。如果為管理員則顯示類別管理和用戶管理 If Session(UserName) = Admin Then a href=39。39。39。color:black39。font style=39。顯示新聞?lì)悇e鏈接,注意根據(jù)類別編號(hào)設(shè)置參數(shù) flag DO WHILE Not stitle = rsCate(CateName) cid = rsCate(CateId) % | a href=39。參數(shù) flag表示指定的新聞?lì)悇e iflag = (flag) 39。全部新聞 /a % Dim rs,rsCate Set rs = () set rsCate = () 39。a href=39。 trtd align=39。 width=39。 color=redb 新 聞 管 理/b/font/p table align=center border=39。 } } /script /head body link=000080 vlink=080080 form id=form1 name=form1 method=POST p align=centerfont style=39。j。 } } function sltNull() { var nn = (Cate)。j。 } } function sltAll() { var nn = (Cate)。 } if (confirm(你確定要?jiǎng)h除這些新聞嗎? )) { = strurl。 if(!s) { alert(請(qǐng)選擇要?jiǎng)h除的新聞 !)。 } else { strid = strid + , + Newsid。 Newsid = (News,j).id+。 j++) { if ((News,j).checked) { n = n + 1。 //返回復(fù)選框 Cate的數(shù)量 for (j=0。 var strid, strurl。 } //檢查選擇的新聞,并執(zhí)行刪除操作 function selectChk() { var s = false。 ()。 oth = oth+,width=+wth+,height=+hth 。 wth=500。 topth=10。 lefth =35。 topth=44。 lefth =147。 var topth。 var hth=。 圖 9 新聞管理界面 : !include file= !include file= html head meta equiv=ContentType content=text/html。 Admin 用戶還可以管理其他用戶。 圖 8 用戶登錄界面 設(shè)計(jì)管理界面 用戶通過身份驗(yàn)證后可以進(jìn)入管理界面,管理界面的文件是 。進(jìn)行身份驗(yàn)證的文件是。新聞管理的文件夾是 ,其具體作用將在后面介紹 。程序中的 nein()函數(shù)可以根據(jù)屏幕的分辨率調(diào)整窗口大小。 程序中的記錄集 rsCate記錄各個(gè)新聞?lì)悇e的標(biāo)題,使用 可以將指針復(fù)位。 顯示最新新聞 這是系統(tǒng)首頁的最主要功能,即顯示每個(gè)類別的中最新的 5 條新聞,并將 3天內(nèi)的新聞?dòng)?new 圖片標(biāo)記。每個(gè)鏈接指向相應(yīng)新聞?lì)悇e的書簽。本系統(tǒng)使用格式為 a 類別編號(hào) 的書簽來定義新 聞?lì)悇e的位置。更多新聞 .../a/p /td/tr/table/td/table loop % /td/table % 39。 href=39。生成“更多新聞”鏈接,查看指定類別所有新聞的腳本為 a target=39。( + CStr(rs(Posttime)) + )/td/tr End If Loop /table 39。顯示新聞提交的時(shí)間 td width=39。 最新的新聞! 39。pic/39。如果新聞中有圖片,則在標(biāo)題中顯示(附圖) If rs(Attpic) Then (附圖 ) End If /a 39。?id= + cstr(rs(id)) + 39。39。a onClick=39。顯示新聞標(biāo)題及鏈接,查看新聞的腳本文件為 trtd width=39。計(jì)數(shù) t = t + 1 39。 cid amp。 border=0 cellspacing=0 cellpadding=0 39。生成另一個(gè)表格,用于顯示新聞標(biāo)題 table width=39。/a == 39。顯示新聞?lì)悇e,并設(shè)置書簽 td bgcolor=ceceffa name=aamp。100%39。變量 t用來記錄 t = 0 39。將指針移至開始位置,分別顯示每個(gè)分類中的新聞 If = False Then End If 39。TEXTDECORATION: none39。39。color:black39。每個(gè)新聞?lì)悇e標(biāo)題被定義為一個(gè)書簽,名為 a類別編號(hào) % a href=a%=cid%font style=39。按順序讀取所有新聞?lì)悇e,保存在記錄集 rsCate中 sql = SELECT * FROM Category ORDER BY CateId Set rsCate = (sql) 39。定義 Recordset對(duì)象,用于保存新聞?lì)悇e記錄集 Set rs = () set rsCate = () % /head body bgcolor=ffffff div align=centerstrongfont color=blue size=3 新 聞 欄 目/font/strongbrbr % 39。 return false。 var newwin=(url,newwin,oth)。 } var oth=toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=+lefth+,top=+topth。 } else { hth=500。 wth=500。 } else if(wth==800) { hth=500。 wth=550。 if(wth==1024) { hth=500。 var hth=。 : !include File= html head title查看新聞 /title meta HTTPEQUIV=Contenttopic content=text/html。sFormValue else sFormName,sFormValue end if end if iFormStart=iFormStart+iStart+1 wend RequestData= set tStream =nothing End Sub Private Sub Class_Terminate if 0 then set objForm=nothing set objFile=nothing set Data_5xsoft =nothing end if End Sub Private function GetFilePath(FullPath) If FullPath Then GetFilePath = left(FullPath,InStrRev(FullPath, \)) Else GetFilePath = End If End function Private function GetFileName(FullPath) If FullPath Then GetFileName = mid(FullPath,InStrRev(FullPath, \)+1) Else GetFileName = End If End function End Class Class FileInfo dim FormName,FileName,FilePath,FileSize,FileType,FileStart Private Sub Class_Initialize FileName = FilePath = FileSize = 0 FileStart= 0 FormName = FileType = End Sub Public function SaveAs(FullPath) dim dr,ErrorChar,i SaveAs=true if trim(fullpath)= or FileStart=0 or FileName= or right(fullpath,1)=/ then exit function set dr=CreateObject() =3 =1 =FileStart dr,FileSize FullPath,2 set dr=nothing SaveAs=false end function End Class /SCRIPT 第七章 系統(tǒng)程序設(shè)計(jì) 與實(shí)現(xiàn) 設(shè)計(jì)主界面 本系統(tǒng)的主界面為 ,顯示新聞?lì)悇e和每個(gè)類別中的前 5條新聞,并提供進(jìn)入管理界面的“新聞管理”鏈接和查詢界面的“新聞查詢”鏈接。如果是表單項(xiàng)目 =1 =3 = iInfoEnd tStream,iFormStartiInfoEnd3 = 0 = 2 =gb2312 sFormValue = if (sFormName) then objForm(sFormName)=objForm(sFormName)amp。取得文件名 iFindStart = InStr(iFindEnd,sInfo,filename=,1)+10 iFindEnd = InStr(iFindStart,s