| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 820 人关注过本帖
标题:图片代码调用问题
只看楼主 加入收藏
angerzl
Rank: 1
等 级:新手上路
帖 子:122
专家分:0
注 册:2007-8-20
结帖率:100%
收藏
 问题点数:0 回复次数:4 
图片代码调用问题
以下代码是图片管理程序中显示图片(这段是显示所有类别的图片)的代码,     然后我想根据分类,调用单独的一类图片放在首页.  哪位帮帮忙,调用代码是什么样的,急~!~!`

<%
         set rs=server.createobject("adodb.recordset")
         rs.open sql,conn,1,1
         if rs.bof and rs.eof then
            rsclose()
            connclose()
               '------------->如果没有记录则关闭数据库的连接(BOF为真值)
            Response.Write("<br><br><br><br><center>对不起。没有相关图片!</center>")
            
        else
        PageShowSize = 10            
        MyPageSize = img           
        If Not IsNumeric(Request.querystring("page")) Or IsEmpty(Request.querystring("page")) Or Request.querystring("page") <=0 Then
                MyPage=1
        Else
                MyPage=Int(Abs(Request.querystring("page")))
        End if
        rs.pagesize=mypagesize
        maxpages=rs.pagecount
        rs.absolutepage=mypage
        total=rs.recordcount
                 Response.Write("<P align=center><table width=90%  cellspacing=""4"" cellpadding=""4"">")
                 do while not rs.eof
                      response.write"<tr>"
                      for i=1 to cel
                          img=rs("news_content")
                          if instr(img,"[img]") then
                              img = Replace(img, "[img]", "<img src=")
                              img = Replace(img, "[/img]", "  border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")  
                          else
                              img = Replace(img, "[uploadimg]", "<img src=upload/")
                              img = Replace(img, "[/uploadimg]", "  border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")  
                          end if
                          Response.Write("<td align=center width=160\>")
                          Response.Write("<table width=97% border=0 cellspacing=""0"" cellpadding=""0""\><tr><td background=""images/bj.jpg"" height=""22"" valign=middle align=center><font color=white>"&rs("title")&"</font></td></tr><tr><td valign=middle align=center>")
                          Response.Write("<a href=view.asp?id="&rs("id")&" target=_blank>"&img&"")
                          Response.Write("<br><br>" & rs("title") & "</a></td></tr></table></td>")
                          rs.movenext
                          if rs.eof or i=MyPageSize then       '------>这句一定要加上。当指针指向最后一个记录时。则退出循环
                            exit do                           '------>但是发现一个问题。当只有两个图片时,而将每页显示一个
                        end if                                '------>图片,这时页面会显示两张图片,为了避免这种情况,所以加了一句
                     next                                    '------->if i=MyPageSize then exit do   这样就可以避免失误了。^!^
                    response.write "</tr>"
                    j=j+1
        if j=rows then exit do      '------------>如果j=rows数刚退出循环
     loop
     response.write "</table>"
    
    PageNextSize=int((MyPage-1)/PageShowSize)+1
    Pagetpage=int((total-1)/rs.PageSize)+1
    if PageNextSize >1 then
             PagePrev=PageShowSize*(PageNextSize-1)
             Response.write "<a href='" & Url & "&page=" & PagePrev & "'><font face=webdings>9</font></a> "
             'Response.write "<a href='" & Url & "&page=1' title='第1页'>页首</a> "
       end if
       if MyPage-1 > 0 then
             Prev_Page = MyPage - 1
             Response.write "<a href='" & Url & "&page=" & Prev_Page & "'><font face=webdings>7</font></a> "
       end if
    
       if Maxpages>=PageNextSize*PageShowSize then
            PageSizeShow = PageShowSize
       Else
            PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
       End if
       If PageSizeShow < 1 Then PageSizeShow = 1
       for PageCounterSize=1 to PageSizeShow
             PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
             if PageLink <> MyPage Then
                  Response.write "<a href='" & Url & "&page=" & PageLink & "'>[" & PageLink & "]</a> "
             else
                  Response.Write "<B>["& PageLink &"]</B> "
             end if
             If PageLink = MaxPages Then Exit for
       Next
    
       if Mypage+1 <=Pagetpage  then
              Next_Page = MyPage + 1
              Response.write "<a href='" & Url & "&page=" & Next_Page & "'><font face=webdings>8</font></A>"
       end if
    
       if MaxPages > PageShowSize*PageNextSize then
              PageNext = PageShowSize * PageNextSize + 1
              'Response.write " <A href='" & Url & "&page=" & Pagetpage & "' title='第"& Pagetpage &"页'>页尾</A>"
              Response.write " <a href='" & Url & "&page=" & PageNext & "'><font face=webdings>:</font></a>"
       End if
       rsclose()
       connclose()
end if
%>
搜索更多相关主题的帖子: 代码 
2007-12-18 16:41
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
img=rs("news_content")                   '图片内容就在news_content这个字段里
                          if instr(img,"[img]") then
                              img = Replace(img, "[img]", "<img src=")
                              img = Replace(img, "[/img]", "  border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")  
                          else
                              img = Replace(img, "[uploadimg]", "<img src=upload/")
                              img = Replace(img, "[/uploadimg]", "  border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")
2007-12-18 18:16
angerzl
Rank: 1
等 级:新手上路
帖 子:122
专家分:0
注 册:2007-8-20
收藏
得分:0 
一个分类调用五张图片,是怎么样用代码的呢?
一个分类调用五张图片,是怎么样用代码的呢?
2007-12-19 08:58
angerzl
Rank: 1
等 级:新手上路
帖 子:122
专家分:0
注 册:2007-8-20
收藏
得分:0 
这两段代码怎么组合呢??
<%
set rs_news=server.createobject("adodb.recordset")
sqltext4="select * from imgbook where classname='创意作品' order by ID desc"
rs_news.open sqltext4,conn,1,1                     
%>


<% img=rs("news_content")                   '图片内容就在news_content这个字段里
                          if instr(img,"[img]") then
                              img = Replace(img, "[img]", "<img src=")
                              img = Replace(img, "[/img]", "  border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")  
                          else
                              img = Replace(img, "[uploadimg]", "<img src=upload/")
                              img = Replace(img, "[/uploadimg]", "  border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")
end if %>
2007-12-19 11:03
ouyangfeixue
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-8-6
收藏
得分:0 
用参数管理
对于这种图片显示我的做法是:
1,首先显示所有的图片,
2,然后根据参数来显示其对应的图片。
我做了个网站,你可以看看是不是你想要的效果。[url]www.[/url]如果需要可以跟我联系。
这个是我的网址:[url]www.[/url]
2007-12-19 11:10
快速回复:图片代码调用问题
数据加载中...
 
   



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

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