背景色交替变化怎么修改?
'过程名:ShowPic'作 用:显示图片文章
'参 数:intClassID ----栏目ID,0为所有栏目,若大于0,则显示指定栏目及其子栏目的图片文章
' ArticleNum ----最多显示多少篇文章
' TitleLen ----标题最多字符数,一个汉字=两个英文字符
' ShowType ----显示方式。1为只有图片+标题,2为图片+标题+内容简介
' Cols ----列数。超过此列数就换行。
' ImgWidth ----图片宽度
' ImgHeight ----图片高度
' ContentLen ----内容最多字符数
' Hot ----是否是热门文章
' Elite ----是否是推荐文章
'=================================================
sub ShowPic(intClassID,ArticleNum,TitleLen,ShowType,Cols,ImgWidth,ImgHeight,ContentLen,Hot,Elite)
dim sqlPic,i,tClass,trs,arrClassID
if ArticleNum<0 or ArticleNum>=50 then
ArticleNum=5
end if
if ShowType<>1 and ShowType<>2 then
ShowType=1
end if
if Cols<=0 or Cols>=10 then
Cols=5
end if
if ImgWidth<0 or ImgWidth>500 then
ImgWidth=150
end if
if ImgHeight<0 or ImgHeight>500 then
ImgHeight=150
end if
if Hot<>True and Hot<>False then
Hot=False
end if
if Elite<>True and Elite<>False then
Elite=False
end if
sqlPic="select top " & ArticleNum
sqlPic=sqlPic & " A.ArticleID,A.ClassID,L.LayoutID,L.LayoutFileName,A.Title,A.Key,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.TitleFontColor,A.TitleFontType,"
if ShowType=2 then
sqlPic=sqlPic & "A.Content,"
end if
sqlPic=sqlPic & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.Tu from Article A"
sqlPic=sqlPic & " inner join Layout L on A.LayoutID=L.LayoutID where A.Deleted=False and A.Passed=True and Tu"
if intClassID>0 then
set tClass=conn.execute("select ClassID,Child,ParentPath from ArticleClass where ClassID=" & intClassID)
if not(tClass.bof and tClass.eof) then
if tClass(1)>0 then
arrClassID=ClassID
set trs=conn.execute("select ClassID from ArticleClass where ParentID=" & tClass(0) & " or ParentPath like '%" & tClass(2) & "," & tClass(0) & ",%' and Child=0 and LinkUrl=''")
do while not trs.eof
arrClassID=arrClassID & "," & trs(0)
trs.movenext
loop
set trs=nothing
sqlPic=sqlPic & " and A.ClassID in (" & arrClassID & ")"
else
sqlPic=sqlPic & " and A.ClassID=" & tClass(0)
end if
set trs=nothing
else
sqlPic=sqlPic & " and A.ClassID=" & tClass(0)
end if
set tClass=nothing
end if
if Hot=True then
sqlPic=sqlPic & " and A.Hits>=" & HitsOfHot
end if
if Elite=True then
sqlPic=sqlPic & " and A.Elite=True "
end if
sqlPic=sqlPic & " order by A.OnTop,A.ArticleID desc"
set rsPic=Server.CreateObject("ADODB.Recordset")
rsPic.open sqlPic,conn,1,1
strPic= "<table width='100%' cellpadding='0' cellspacing='5' border='0' align='center'><tr valign='top'>"
if rsPic.bof and rsPic.eof then
strPic= strPic & "<td align='center'><img src='images/NoPic.jpg' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'></td>"
else
i=0
if ShowType=1 then
do while not rsPic.eof
strPic=strPic & "<td align='center'>"
strPic=strPic & "</td>"
rsPic.movenext
i=i+1
if ((i mod Cols=0) and (not rsPic.eof)) then strPic=strPic & "</tr><tr valign='top'>"
loop
elseif ShowType=2 then
do while not rsPic.eof
strPic=strPic & "<td align='center'>"
strPic=strPic & "</td><td valign='top' algin='center' class='left' bgcolor='#FFFFCC'><a href='" & rsPic("LayoutFileName") & "?ArticleID=" & rsPic("ArticleID") & "' target='_blank'> "&"<font size='2px' color='#0066FF'>" & " "& rsPic("Title")&"</font><br>" &left(nohtml(rsPic("Content")),ContentLen) & "</a><hr size=1 style='BORDER-bottom: #1C3F78 dotted'></td>"
rsPic.movenext
i=i+1
if ((i mod Cols=0) and (not rsPic.eof)) then strPic=strPic & "</tr><tr valign='top'>"
loop
end if
end if
strPic=strPic & "</tr></table>"
response.write strPic
rsPic.close
end sub
[ 本帖最后由 lh5399975 于 2011-5-17 16:11 编辑 ]