| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 385 人关注过本帖
标题:背景色交替变化怎么修改?
只看楼主 加入收藏
lh5399975
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-9-10
收藏
 问题点数:0 回复次数:3 
背景色交替变化怎么修改?
'过程名: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'>" & "&nbsp;&nbsp;"& 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 编辑 ]
搜索更多相关主题的帖子: 图片 文章 背景色 汉字 
2011-05-17 15:55
lh5399975
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-9-10
收藏
得分:0 
回复 楼主 lh5399975
没人帮帮我吗

[ 本帖最后由 lh5399975 于 2011-5-17 16:11 编辑 ]
2011-05-17 16:09
lh5399975
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-9-10
收藏
得分:0 
"<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'>" & "&nbsp;&nbsp;"& 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>"

加在这段具体什么位置?还要增加变量吗?
2011-05-17 16:54
lh5399975
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-9-10
收藏
得分:0 
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'>" & "&nbsp;&nbsp;"& 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
加在这段什么位置 怎么加呢?我加了 只是第一行变了 第三行就不起作用了
2011-05-18 12:56
快速回复:背景色交替变化怎么修改?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019250 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved