| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1752 人关注过本帖
标题:asp中 mod运用问题
只看楼主 加入收藏
bluesir
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-10-14
收藏
 问题点数:0 回复次数:6 
asp中 mod运用问题
这是一个广告显示,我想做成三行 每行4个图片 下面我弄得有些错误 请高手帮助改正一下 谢谢!! Rs.Open Sql , Conn , 1 , 1
If Rs.Eof Then
Ind_01 = ""
Ind_01 = Ind_01 & "<table align=""center"" width=""730"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
For i = 1 To 3
Ind_01 = Ind_01 & "<tr>"
For j = 1 To 4
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
Next
Ind_01 = Ind_01 & "</tr>"
Next
Ind_01 = Ind_01 & "</table>"
Else
Ind_01 = ""
Ind_01 = Ind_01 & "<table align=""center"" width=""730"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
Ind_01 = Ind_01 & "<tr>"
i = 0
Do While Not Rs.Eof
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top"">"
If Rs("AdType") = "1" Then
Ind_01 = Ind_01 & "<object classid=""clsid27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.,0,19,0"" width=""155"" height=""50"">"
Ind_01 = Ind_01 & "<param name=""movie"" value="""& Rs("AdPicUrl") &""" />"
Ind_01 = Ind_01 & "<param name=""quality"" value=""high"" />"
Ind_01 = Ind_01 & "<embed src="""& Rs("AdPicUrl") &""" quality=""high"" pluginspage=""http://www. type=""application/x-shockwave-flash"" width=""155"" height=""50""></embed>"
Ind_01 = Ind_01 & "</object>"
Else
If Rs("AdUrl") <> "" And Rs("AdUrl") <> "http://" Then
Ind_01 = Ind_01 & "<a href="""& Rs("AdUrl") &""" target=""_blank""><img src="""& Rs("AdPicUrl") &""" width=""155"" height=""50"" border=""0"" /></a>"
Else
Ind_01 = Ind_01 & "<img src="""& Rs("AdPicUrl") &""" width=""155"" height=""50"" border=""0"" />"
End If
End If
Ind_01 = Ind_01 & "</td>"
Rs.MoveNext
i = i + 1
If i >= 12 Then Exit Do
If i Mod 4 = 0 And Not Rs.Eof Then Ind_01 = Ind_01 & "</tr><tr>"
If ((i\3) + 1 < 2 Or i Mod 3 > 0) And Rs.Eof Then
If i Mod 3 > 0 Then
For j = (i Mod 4) + 1 To 4
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
Next
End If
If (i\3) + 1 < 2 Then
For i = (i\3) + 3 To 4
Ind_01 = Ind_01 & "<tr>"
For j = 1 To 4
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
Next
Ind_01 = Ind_01 & "</tr>"
Next
请高手帮助解决一下!!谢谢!!主要是上面的蓝色部分,调用12个 每行4个 显示三行
搜索更多相关主题的帖子: mod asp 
2008-10-14 14:25
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
If Rs.Eof Then
   Ind_01 = ""
   Ind_01 = Ind_01 & "<table align=""center"" width=""730"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
   For i = 1 To 3
       Ind_01 = Ind_01 & "<tr>"
       For j = 1 To 4
           Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
       Next
       Ind_01 = Ind_01 & "</tr>"
   Next
       Ind_01 = Ind_01 & "</table>"
Else
   Ind_01 = ""
   Ind_01 = Ind_01 & "<table align=""center"" width=""730"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
   Ind_01 = Ind_01 & "<tr>"
   i = 0
   Do While Not Rs.Eof
      Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top"">"
      If Rs("AdType") = "1" Then
         Ind_01 = Ind_01 & "<object classid=""clsid27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.,0,19,0"" width=""155"" height=""50"">"
         Ind_01 = Ind_01 & "<param name=""movie"" value="""& Rs("AdPicUrl") &""" />"
         Ind_01 = Ind_01 & "<param name=""quality"" value=""high"" />"
         Ind_01 = Ind_01 & "<embed src="""& Rs("AdPicUrl") &""" quality=""high"" pluginspage=""http://www. type=""application/x-shockwave-flash"" width=""155"" height=""50""></embed>"
         Ind_01 = Ind_01 & "</object>"
     Else
         If Rs("AdUrl") <> "" And Rs("AdUrl") <> "http://" Then
            Ind_01 = Ind_01 & "<a href="""& Rs("AdUrl") &""" target=""_blank""><img src="""& Rs("AdPicUrl") &""" width=""155"" height=""50"" border=""0"" /></a>"
         Else
            Ind_01 = Ind_01 & "<img src="""& Rs("AdPicUrl") &""" width=""155"" height=""50"" border=""0"" />"
         End If
     End If
     Ind_01 = Ind_01 & "</td>"
     Rs.MoveNext
     i = i + 1
     If i >= 12 Then Exit Do
     If i Mod 4 = 0 And Not Rs.Eof Then Ind_01 = Ind_01 & "</tr><tr>"
     If ((i\3) + 1 < 2 Or i Mod 3 > 0) And Rs.Eof Then
         If i Mod 3 > 0 Then
            For j = (i Mod 4) + 1 To 4
                Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
            Next
         End If
         If (i\3) + 1 < 2 Then
            For i = (i\3) + 3 To 4
                Ind_01 = Ind_01 & "<tr>"
                For j = 1 To 4
                    Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
                Next
                Ind_01 = Ind_01 & "</tr>"
            Next
        '这里没有End IF
替楼主编辑一下,写代码注意格式很重要的。
2008-10-14 14:45
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
个人觉得如果是12个每行4个显示3行,可以考虑For循环外行内列的模式
Dim r,c
For r=1 To 3
    For c=1 To 4
        Response.Write "第"&CStr(i)&"个"
    Next
Next
2008-10-14 14:49
孤独冷雨
Rank: 10Rank: 10Rank: 10
来 自:安徽滁州
等 级:贵宾
威 望:23
帖 子:1247
专家分:1909
注 册:2007-6-4
收藏
得分:0 
同意LS的.简单明了!
顺便说一下.论坛Logo也太难看了吧?

[[it] 本帖最后由 孤独冷雨 于 2008-10-14 15:00 编辑 [/it]]
2008-10-14 14:59
bluesir
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-10-14
收藏
得分:0 
回复 2# yms123 的帖子
按照您的改法,修改后还是不行,直接显示一行了,我把那个文件发上来,请帮我看一下吧,谢谢!!不能发附件,我给个下载地址

http://www.  修改后如果可以请发到我的邮箱 bluesirhao@  非常感谢!!
2008-10-14 15:04
孤独冷雨
Rank: 10Rank: 10Rank: 10
来 自:安徽滁州
等 级:贵宾
威 望:23
帖 子:1247
专家分:1909
注 册:2007-6-4
收藏
得分:0 
Microsoft JET Database Engine 错误 '80040e14'

语法错误 (操作符丢失) 在查询表达式 'ComId = 3831,' 中。

/Company_View.asp,行 31

呵呵 你网站有洞!
2008-10-14 15:13
bluesir
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-10-14
收藏
得分:0 
再一次求助 asp中 mod运用问题
asp中 mod运用问题
这是一个广告显示,我想做成三行 每行4个图片 下面我弄得有些错误 请高手帮助改正一下 谢谢!!

Rs.Open Sql , Conn , 1 , 1
If Rs.Eof Then
Ind_01 = ""
Ind_01 = Ind_01 & "<table align=""center"" width=""730"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
For i = 1 To 3
Ind_01 = Ind_01 & "<tr>"
For j = 1 To 4
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
Next
Ind_01 = Ind_01 & "</tr>"
Next
Ind_01 = Ind_01 & "</table>"
Else
Ind_01 = ""
Ind_01 = Ind_01 & "<table align=""center"" width=""730"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
Ind_01 = Ind_01 & "<tr>"
i = 0
Do While Not Rs.Eof
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top"">"
If Rs("AdType") = "1" Then
Ind_01 = Ind_01 & "<object classid=""clsid27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.,0,19,0"" width=""155"" height=""50"">"
Ind_01 = Ind_01 & "<param name=""movie"" value="""& Rs("AdPicUrl") &""" />"
Ind_01 = Ind_01 & "<param name=""quality"" value=""high"" />"
Ind_01 = Ind_01 & "<embed src="""& Rs("AdPicUrl") &""" quality=""high"" pluginspage=""http://www. type=""application/x-shockwave-flash"" width=""155"" height=""50""></embed>"
Ind_01 = Ind_01 & "</object>"
Else
If Rs("AdUrl") <> "" And Rs("AdUrl") <> "http://" Then
Ind_01 = Ind_01 & "<a href="""& Rs("AdUrl") &""" target=""_blank""><img src="""& Rs("AdPicUrl") &""" width=""155"" height=""50"" border=""0"" /></a>"
Else
Ind_01 = Ind_01 & "<img src="""& Rs("AdPicUrl") &""" width=""155"" height=""50"" border=""0"" />"
End If
End If
Ind_01 = Ind_01 & "</td>"
Rs.MoveNext
i = i + 1
If i >= 12 Then Exit Do
If i Mod 4 = 0 And Not Rs.Eof Then Ind_01 = Ind_01 & "</tr><tr>"
If ((i\3) + 1 < 2 Or i Mod 3 > 0) And Rs.Eof Then
If i Mod 3 > 0 Then
For j = (i Mod 4) + 1 To 4
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
Next
End If
If (i\3) + 1 < 2 Then
For i = (i\3) + 3 To 4
Ind_01 = Ind_01 & "<tr>"
For j = 1 To 4
Ind_01 = Ind_01 & "<td width=""180"" height=""60"" valign=""top""><img src=""Images/Ad_Ind_02_def.jpg"" width=""155"" height=""50"" border=""0"" /></td>"
Next
Ind_01 = Ind_01 & "</tr>"
Next
请高手帮助解决一下!!谢谢!!主要是上面的蓝色部分,调用12个 每行4个 显示三行

附件中是文件


非常感谢!!

asp.rar (1.49 KB) 文件

2008-10-15 20:14
快速回复:asp中 mod运用问题
数据加载中...
 
   



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

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