这样的asp代码怎么改成横向的?现在是竖着放的,我想改成每行4列显示
源码太长,这里放不下,看这里http://hi.baidu.com/waaoo/blog/item/776662a9bf0a24fd1e17a236.html这个代码是一...
源码太长,这里放不下,看这里
http://hi.baidu.com/waaoo/blog/item/776662a9bf0a24fd1e17a236.html
这个代码是一个JS调用页的
目前状况是JS调用时不管数量多少都是竖着,而我想改成表格形式,每行4列显示,超过4个自动换一行继续显示
请帮我改一下,然后发到我的信箱 c363c@163.com 中,谢谢,采用的话再加分! 展开
http://hi.baidu.com/waaoo/blog/item/776662a9bf0a24fd1e17a236.html
这个代码是一个JS调用页的
目前状况是JS调用时不管数量多少都是竖着,而我想改成表格形式,每行4列显示,超过4个自动换一行继续显示
请帮我改一下,然后发到我的信箱 c363c@163.com 中,谢谢,采用的话再加分! 展开
展开全部
下面是两个方法
第一种:
<!--#include file="../Conn.asp" -->
<!--#include file="../inc/Cl_ClsMain.asp" -->
<!--#include file="../inc/Ubb_Code.asp" -->
<%
Pl.GetWeb_Setting
dim ClassID,IncludeChild,SpecialID,ArticleNum,TitleMaxLen,ContentMaxLen,ShowType,ShowCols
dim ShowProperty,ShowClassName,ShowIncludePic,ShowTitle,ShowUpdateTime,ShowHits,ShowAuthor,ShowHot,ShowMore
dim Hot,Elite,DateNum,OrderField,OrderType,ImgWidth,ImgHeight
dim SystemPath,rs,sql,str,str1,topicLen,topic
dim i,FileType,SrtTitleMaxLen
dim tClass,trs,arrClassID
dim Author,AuthorName,AuthorEmail
ClassID=trim(request.querystring("ClassID"))
IncludeChild=trim(request.QueryString("IncludeChild"))
SpecialID=trim(request.querystring("SpecialID"))
ArticleNum=trim(request.querystring("ArticleNum"))
TitleMaxLen=trim(request.querystring("TitleMaxLen"))
ContentMaxLen=trim(request.querystring("ContentMaxLen"))
ShowType=trim(request.querystring("ShowType"))
ShowCols=trim(request.querystring("ShowCols"))
ShowProperty=trim(request.querystring("ShowProperty"))
ShowClassName=trim(request.querystring("ShowClassName"))
ShowIncludePic=trim(request.querystring("ShowIncludePic"))
ShowTitle=trim(request.querystring("ShowTitle"))
ShowUpdateTime=trim(request.querystring("ShowUpdateTime"))
ShowHits=trim(request.querystring("ShowHits"))
ShowAuthor=trim(request.querystring("ShowAuthor"))
ShowHot=trim(request.querystring("困丛ShowHot"))
ShowMore=trim(request.querystring("ShowMore"))
Hot=trim(request.querystring("Hot"))
Elite=trim(request.querystring("告空Elite"))
DateNum=trim(request.querystring("DateNum"))
OrderField=trim(request.querystring("OrderField"))
OrderType=trim(request.querystring("OrderType"))
ImgWidth=trim(request.querystring("ImgWidth"))
ImgHeight=trim(request.querystring("ImgHeight"))
SystemPath="http://"&request.servervariables("server_name") & Pl.Web_Info(10)
if ShowType<>"" then
ShowType=Cint(ShowType)
else
ShowType=1
end if
if ShowCols<袜尺瞎>"" then
ShowCols=Cint(ShowCols)
else
ShowCols=1
end if
if ContentMaxLen<>"" then
ContentMaxLen=Cint(ContentMaxLen)
else
ContentMaxLen=200
end if
if ClassID="" then
ClassID=0
else
ClassID=Clng(ClassID)
end if
if SpecialID="" then
SpecialID=0
else
SpecialID=Clng(SpecialID)
end if
sql="select"
if ArticleNum<>"" then sql=sql & " top " & Cint(ArticleNum)
if ShowClassName="true" then
sql=sql & " A.ArticleID,A.ClassID,C.ClassName,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,"
sql=sql & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A"
sql=sql & " inner join Pl_ArticleClass C on A.ClassID=C.ClassID where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
else
sql=sql & " A.ArticleID,A.ClassID,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
end if
'response.write "正常!"
if ClassID>0 then
set tClass=Pl.Execute("select ClassID,ParentPath,Child From Pl_ArticleClass where ClassID=" & ClassID)
if tClass.bof and tClass.eof then
response.write "document.write (" & Chr(34) & "找不到指定的栏目,可能已经被管理员删除!请重新生成JS调用代码。" & Chr(34) & ");"
response.end
else
if IncludeChild="true" then
if tClass(2)>0 then
arrClassID=tClass(0)
set trs=Pl.Execute("select ClassID from Pl_ArticleClass where ParentID=" & tClass(0) & " or ParentPath like '%" & tClass(1) & "," & tClass(0) & ",%' and Child=0 and LinkUrl=''")
do while not trs.eof
arrClassID=arrClassID & "," & trs(0)
trs.movenext
loop
set trs=nothing
sql=sql & " and A.ClassID in (" & arrClassID & ")"
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
end if
set tClass=nothing
end if
if SpecialID>0 then sql=sql & " and A.SpecialID=" & SpecialID
if ShowType=3 or ShowType=4 then sql=sql & " and A.DefaultPicUrl<>''"
if Hot="true" then sql=sql & " and A.Hits>=" & Clng(Pl.Web_Setting(14))
if Elite="true" then sql=sql & " and A.Elite="&TrueType&""
if DateNum<>"" then sql=sql & " and DATEDIFF('d',A.UpdateTime,Date())<=" & Cint(DateNum)
sql=sql & " order by A.OnTop asc"
if OrderField<>"" then
sql=sql & " ,A." & OrderField & ""
else
sql=sql & " ,A.ArticleID"
end if
if OrderType<>"" then
sql=sql & " " & OrderType & ""
else
sql=sql & " asc"
end if
set rs=server.createObject("Adodb.recordset")
rs.open sql,Conn,1,1
if rs.bof and rs.eof then
response.write "document.write (" & Chr(34) & "没有符合条件的信息" & Chr(34) & ");"
else
if ShowType=3 or ShowType=4 then
response.write "document.write (" & Chr(34) & "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>" & Chr(34) & ");" & vbcrlf
end if
do while not rs.eof
if TitleMaxLen<>"" then
SrtTitleMaxLen=Clng(TitleMaxLen)
else
SrtTitleMaxLen=50
end if
Author=rs("Author")
if instr(Author,"|")>0 then
AuthorName=left(Author,instr(Author,"|")-1)
AuthorEmail=right(Author,len(Author)-instr(Author,"|")-1)
else
AuthorName=Author
AuthorEmail=""
end if
if ShowType=1 or ShowType=2 then
str=""
else
str=""
end if
if ShowType=1 or ShowType=2 then
topic=Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen))
else
if ShowClassName="true" then
str=str & ""
else
str=str & "<td align='center'><a href='" & SystemPath & "Article/ArticleShow.asp?ArticleID=" & rs("articleid") & "' title='品名:" & rs("Title") & "\n" & "价格:" & AuthorName & "元\n" & "更新时间:" & rs("UpdateTime") & "\n" & "点击次数:" & rs("Hits") & " ' target='_blank'><font color=red>"
end if
FileType=right(lcase(rs("DefaultPicUrl")),3)
if fileType="jpg" or fileType="bmp" or fileType="png" or fileType="gif" then
str=str & "<img src='" & ChkPicUrl(rs("DefaultPicUrl")) & "' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><br><b>"
else
str=str & "<img src='" & SystemPath & "images/NoPic2.jpg' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><b>"
end if
str=str & Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen)) & "</font></b>"
str=str & "<br>价格:¥ " & AuthorName & " 元<br><img src=../htxs/cpxx.gif border=0 width=102 height=34></a><br></td>"
end if
str=str & ""
rs.movenext
if ShowType=3 or ShowType=4 then
i=i+1
if ((i mod ShowCols=0) and (not rs.eof)) then
str=str & "</tr><tr>"
end if
end if
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
loop
if ShowType=1 or ShowType=2 then
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
else
str=""
str=str & "</tr></table>"
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
end if
end if
rs.close
set rs=nothing
'call CloseConn()
Function ChkPicUrl(PicUrl)
If IsEmpTy(Trim(PicUrl)) then
ChkPicUrl=SystemPath & "images/NoPic.Gif"
else
PicUrl=lcase(Trim(PicUrl))
If left(PicUrl,7)="http://" then
ChkPicUrl=PicUrl
ElseIf left(PicUrl,9)="{$webdir}" then
ChkPicUrl=Replace(PicUrl,"{$webdir}",SystemPath)
Else
ChkPicUrl=Replace(SystemPath & PicUrl,"{$webdir}",Pl.Web_Info(10))
End if
End if
End Function
%>
方法二:
<!--#include file="../Conn.asp" -->
<!--#include file="../inc/Cl_ClsMain.asp" -->
<!--#include file="../inc/Ubb_Code.asp" -->
<%
Pl.GetWeb_Setting
dim ClassID,IncludeChild,SpecialID,ArticleNum,TitleMaxLen,ContentMaxLen,ShowType,ShowCols
dim ShowProperty,ShowClassName,ShowIncludePic,ShowTitle,ShowUpdateTime,ShowHits,ShowAuthor,ShowHot,ShowMore
dim Hot,Elite,DateNum,OrderField,OrderType,ImgWidth,ImgHeight
dim SystemPath,rs,sql,str,str1,topicLen,topic
dim i,FileType,SrtTitleMaxLen
dim tClass,trs,arrClassID
dim Author,AuthorName,AuthorEmail
ClassID=trim(request.querystring("ClassID"))
IncludeChild=trim(request.QueryString("IncludeChild"))
SpecialID=trim(request.querystring("SpecialID"))
ArticleNum=trim(request.querystring("ArticleNum"))
TitleMaxLen=trim(request.querystring("TitleMaxLen"))
ContentMaxLen=trim(request.querystring("ContentMaxLen"))
ShowType=trim(request.querystring("ShowType"))
ShowCols=trim(request.querystring("ShowCols"))
ShowProperty=trim(request.querystring("ShowProperty"))
ShowClassName=trim(request.querystring("ShowClassName"))
ShowIncludePic=trim(request.querystring("ShowIncludePic"))
ShowTitle=trim(request.querystring("ShowTitle"))
ShowUpdateTime=trim(request.querystring("ShowUpdateTime"))
ShowHits=trim(request.querystring("ShowHits"))
ShowAuthor=trim(request.querystring("ShowAuthor"))
ShowHot=trim(request.querystring("ShowHot"))
ShowMore=trim(request.querystring("ShowMore"))
Hot=trim(request.querystring("Hot"))
Elite=trim(request.querystring("Elite"))
DateNum=trim(request.querystring("DateNum"))
OrderField=trim(request.querystring("OrderField"))
OrderType=trim(request.querystring("OrderType"))
ImgWidth=trim(request.querystring("ImgWidth"))
ImgHeight=trim(request.querystring("ImgHeight"))
SystemPath="http://"&request.servervariables("server_name") & Pl.Web_Info(10)
if ShowType<>"" then
ShowType=Cint(ShowType)
else
ShowType=1
end if
if ShowCols<>"" then
ShowCols=Cint(ShowCols)
else
ShowCols=1
end if
if ContentMaxLen<>"" then
ContentMaxLen=Cint(ContentMaxLen)
else
ContentMaxLen=200
end if
if ClassID="" then
ClassID=0
else
ClassID=Clng(ClassID)
end if
if SpecialID="" then
SpecialID=0
else
SpecialID=Clng(SpecialID)
end if
sql="select"
if ArticleNum<>"" then sql=sql & " top " & Cint(ArticleNum)
if ShowClassName="true" then
sql=sql & " A.ArticleID,A.ClassID,C.ClassName,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,"
sql=sql & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A"
sql=sql & " inner join Pl_ArticleClass C on A.ClassID=C.ClassID where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
else
sql=sql & " A.ArticleID,A.ClassID,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
end if
'response.write "正常!"
if ClassID>0 then
set tClass=Pl.Execute("select ClassID,ParentPath,Child From Pl_ArticleClass where ClassID=" & ClassID)
if tClass.bof and tClass.eof then
response.write "document.write (" & Chr(34) & "找不到指定的栏目,可能已经被管理员删除!请重新生成JS调用代码。" & Chr(34) & ");"
response.end
else
if IncludeChild="true" then
if tClass(2)>0 then
arrClassID=tClass(0)
set trs=Pl.Execute("select ClassID from Pl_ArticleClass where ParentID=" & tClass(0) & " or ParentPath like '%" & tClass(1) & "," & tClass(0) & ",%' and Child=0 and LinkUrl=''")
do while not trs.eof
arrClassID=arrClassID & "," & trs(0)
trs.movenext
loop
set trs=nothing
sql=sql & " and A.ClassID in (" & arrClassID & ")"
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
end if
set tClass=nothing
end if
if SpecialID>0 then sql=sql & " and A.SpecialID=" & SpecialID
if ShowType=3 or ShowType=4 then sql=sql & " and A.DefaultPicUrl<>''"
if Hot="true" then sql=sql & " and A.Hits>=" & Clng(Pl.Web_Setting(14))
if Elite="true" then sql=sql & " and A.Elite="&TrueType&""
if DateNum<>"" then sql=sql & " and DATEDIFF('d',A.UpdateTime,Date())<=" & Cint(DateNum)
sql=sql & " order by A.OnTop asc"
if OrderField<>"" then
sql=sql & " ,A." & OrderField & ""
else
sql=sql & " ,A.ArticleID"
end if
if OrderType<>"" then
sql=sql & " " & OrderType & ""
else
sql=sql & " asc"
end if
set rs=server.createObject("Adodb.recordset")
rs.open sql,Conn,1,1
if rs.bof and rs.eof then
response.write "document.write (" & Chr(34) & "没有符合条件的信息" & Chr(34) & ");"
else
if ShowType=3 or ShowType=4 then
response.write "document.write (" & Chr(34) & "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center'>" & Chr(34) & ");" & vbcrlf
end if
do while not rs.eof
if TitleMaxLen<>"" then
SrtTitleMaxLen=Clng(TitleMaxLen)
else
SrtTitleMaxLen=50
end if
Author=rs("Author")
if instr(Author,"|")>0 then
AuthorName=left(Author,instr(Author,"|")-1)
AuthorEmail=right(Author,len(Author)-instr(Author,"|")-1)
else
AuthorName=Author
AuthorEmail=""
end if
if ShowType=1 or ShowType=2 then
str=""
else
str=""
end if
if ShowType=1 or ShowType=2 then
topic=Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen))
else
if ShowClassName="true" then
str=str & ""
else
str=str & "<div style='width:24%'><a href='" & SystemPath & "Article/ArticleShow.asp?ArticleID=" & rs("articleid") & "' title='品名:" & rs("Title") & "\n" & "价格:" & AuthorName & "元\n" & "更新时间:" & rs("UpdateTime") & "\n" & "点击次数:" & rs("Hits") & " ' target='_blank'><font color=red>"
end if
FileType=right(lcase(rs("DefaultPicUrl")),3)
if fileType="jpg" or fileType="bmp" or fileType="png" or fileType="gif" then
str=str & "<img src='" & ChkPicUrl(rs("DefaultPicUrl")) & "' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><br><b>"
else
str=str & "<img src='" & SystemPath & "images/NoPic2.jpg' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><b>"
end if
str=str & Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen)) & "</font></b>"
str=str & "<br>价格:¥ " & AuthorName & " 元<br><img src=../htxs/cpxx.gif border=0 width=102 height=34></a><br></div>"
end if
str=str & ""
rs.movenext
if ShowType=3 or ShowType=4 then
i=i+1
if ((i mod ShowCols=0) and (not rs.eof)) then
str=str & ""
end if
end if
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
loop
if ShowType=1 or ShowType=2 then
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
else
str=""
str=str & "</td></tr></table>"
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
end if
end if
rs.close
set rs=nothing
'call CloseConn()
Function ChkPicUrl(PicUrl)
If IsEmpTy(Trim(PicUrl)) then
ChkPicUrl=SystemPath & "images/NoPic.Gif"
else
PicUrl=lcase(Trim(PicUrl))
If left(PicUrl,7)="http://" then
ChkPicUrl=PicUrl
ElseIf left(PicUrl,9)="{$webdir}" then
ChkPicUrl=Replace(PicUrl,"{$webdir}",SystemPath)
Else
ChkPicUrl=Replace(SystemPath & PicUrl,"{$webdir}",Pl.Web_Info(10))
End if
End if
End Function
%>
第一种:
<!--#include file="../Conn.asp" -->
<!--#include file="../inc/Cl_ClsMain.asp" -->
<!--#include file="../inc/Ubb_Code.asp" -->
<%
Pl.GetWeb_Setting
dim ClassID,IncludeChild,SpecialID,ArticleNum,TitleMaxLen,ContentMaxLen,ShowType,ShowCols
dim ShowProperty,ShowClassName,ShowIncludePic,ShowTitle,ShowUpdateTime,ShowHits,ShowAuthor,ShowHot,ShowMore
dim Hot,Elite,DateNum,OrderField,OrderType,ImgWidth,ImgHeight
dim SystemPath,rs,sql,str,str1,topicLen,topic
dim i,FileType,SrtTitleMaxLen
dim tClass,trs,arrClassID
dim Author,AuthorName,AuthorEmail
ClassID=trim(request.querystring("ClassID"))
IncludeChild=trim(request.QueryString("IncludeChild"))
SpecialID=trim(request.querystring("SpecialID"))
ArticleNum=trim(request.querystring("ArticleNum"))
TitleMaxLen=trim(request.querystring("TitleMaxLen"))
ContentMaxLen=trim(request.querystring("ContentMaxLen"))
ShowType=trim(request.querystring("ShowType"))
ShowCols=trim(request.querystring("ShowCols"))
ShowProperty=trim(request.querystring("ShowProperty"))
ShowClassName=trim(request.querystring("ShowClassName"))
ShowIncludePic=trim(request.querystring("ShowIncludePic"))
ShowTitle=trim(request.querystring("ShowTitle"))
ShowUpdateTime=trim(request.querystring("ShowUpdateTime"))
ShowHits=trim(request.querystring("ShowHits"))
ShowAuthor=trim(request.querystring("ShowAuthor"))
ShowHot=trim(request.querystring("困丛ShowHot"))
ShowMore=trim(request.querystring("ShowMore"))
Hot=trim(request.querystring("Hot"))
Elite=trim(request.querystring("告空Elite"))
DateNum=trim(request.querystring("DateNum"))
OrderField=trim(request.querystring("OrderField"))
OrderType=trim(request.querystring("OrderType"))
ImgWidth=trim(request.querystring("ImgWidth"))
ImgHeight=trim(request.querystring("ImgHeight"))
SystemPath="http://"&request.servervariables("server_name") & Pl.Web_Info(10)
if ShowType<>"" then
ShowType=Cint(ShowType)
else
ShowType=1
end if
if ShowCols<袜尺瞎>"" then
ShowCols=Cint(ShowCols)
else
ShowCols=1
end if
if ContentMaxLen<>"" then
ContentMaxLen=Cint(ContentMaxLen)
else
ContentMaxLen=200
end if
if ClassID="" then
ClassID=0
else
ClassID=Clng(ClassID)
end if
if SpecialID="" then
SpecialID=0
else
SpecialID=Clng(SpecialID)
end if
sql="select"
if ArticleNum<>"" then sql=sql & " top " & Cint(ArticleNum)
if ShowClassName="true" then
sql=sql & " A.ArticleID,A.ClassID,C.ClassName,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,"
sql=sql & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A"
sql=sql & " inner join Pl_ArticleClass C on A.ClassID=C.ClassID where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
else
sql=sql & " A.ArticleID,A.ClassID,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
end if
'response.write "正常!"
if ClassID>0 then
set tClass=Pl.Execute("select ClassID,ParentPath,Child From Pl_ArticleClass where ClassID=" & ClassID)
if tClass.bof and tClass.eof then
response.write "document.write (" & Chr(34) & "找不到指定的栏目,可能已经被管理员删除!请重新生成JS调用代码。" & Chr(34) & ");"
response.end
else
if IncludeChild="true" then
if tClass(2)>0 then
arrClassID=tClass(0)
set trs=Pl.Execute("select ClassID from Pl_ArticleClass where ParentID=" & tClass(0) & " or ParentPath like '%" & tClass(1) & "," & tClass(0) & ",%' and Child=0 and LinkUrl=''")
do while not trs.eof
arrClassID=arrClassID & "," & trs(0)
trs.movenext
loop
set trs=nothing
sql=sql & " and A.ClassID in (" & arrClassID & ")"
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
end if
set tClass=nothing
end if
if SpecialID>0 then sql=sql & " and A.SpecialID=" & SpecialID
if ShowType=3 or ShowType=4 then sql=sql & " and A.DefaultPicUrl<>''"
if Hot="true" then sql=sql & " and A.Hits>=" & Clng(Pl.Web_Setting(14))
if Elite="true" then sql=sql & " and A.Elite="&TrueType&""
if DateNum<>"" then sql=sql & " and DATEDIFF('d',A.UpdateTime,Date())<=" & Cint(DateNum)
sql=sql & " order by A.OnTop asc"
if OrderField<>"" then
sql=sql & " ,A." & OrderField & ""
else
sql=sql & " ,A.ArticleID"
end if
if OrderType<>"" then
sql=sql & " " & OrderType & ""
else
sql=sql & " asc"
end if
set rs=server.createObject("Adodb.recordset")
rs.open sql,Conn,1,1
if rs.bof and rs.eof then
response.write "document.write (" & Chr(34) & "没有符合条件的信息" & Chr(34) & ");"
else
if ShowType=3 or ShowType=4 then
response.write "document.write (" & Chr(34) & "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>" & Chr(34) & ");" & vbcrlf
end if
do while not rs.eof
if TitleMaxLen<>"" then
SrtTitleMaxLen=Clng(TitleMaxLen)
else
SrtTitleMaxLen=50
end if
Author=rs("Author")
if instr(Author,"|")>0 then
AuthorName=left(Author,instr(Author,"|")-1)
AuthorEmail=right(Author,len(Author)-instr(Author,"|")-1)
else
AuthorName=Author
AuthorEmail=""
end if
if ShowType=1 or ShowType=2 then
str=""
else
str=""
end if
if ShowType=1 or ShowType=2 then
topic=Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen))
else
if ShowClassName="true" then
str=str & ""
else
str=str & "<td align='center'><a href='" & SystemPath & "Article/ArticleShow.asp?ArticleID=" & rs("articleid") & "' title='品名:" & rs("Title") & "\n" & "价格:" & AuthorName & "元\n" & "更新时间:" & rs("UpdateTime") & "\n" & "点击次数:" & rs("Hits") & " ' target='_blank'><font color=red>"
end if
FileType=right(lcase(rs("DefaultPicUrl")),3)
if fileType="jpg" or fileType="bmp" or fileType="png" or fileType="gif" then
str=str & "<img src='" & ChkPicUrl(rs("DefaultPicUrl")) & "' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><br><b>"
else
str=str & "<img src='" & SystemPath & "images/NoPic2.jpg' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><b>"
end if
str=str & Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen)) & "</font></b>"
str=str & "<br>价格:¥ " & AuthorName & " 元<br><img src=../htxs/cpxx.gif border=0 width=102 height=34></a><br></td>"
end if
str=str & ""
rs.movenext
if ShowType=3 or ShowType=4 then
i=i+1
if ((i mod ShowCols=0) and (not rs.eof)) then
str=str & "</tr><tr>"
end if
end if
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
loop
if ShowType=1 or ShowType=2 then
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
else
str=""
str=str & "</tr></table>"
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
end if
end if
rs.close
set rs=nothing
'call CloseConn()
Function ChkPicUrl(PicUrl)
If IsEmpTy(Trim(PicUrl)) then
ChkPicUrl=SystemPath & "images/NoPic.Gif"
else
PicUrl=lcase(Trim(PicUrl))
If left(PicUrl,7)="http://" then
ChkPicUrl=PicUrl
ElseIf left(PicUrl,9)="{$webdir}" then
ChkPicUrl=Replace(PicUrl,"{$webdir}",SystemPath)
Else
ChkPicUrl=Replace(SystemPath & PicUrl,"{$webdir}",Pl.Web_Info(10))
End if
End if
End Function
%>
方法二:
<!--#include file="../Conn.asp" -->
<!--#include file="../inc/Cl_ClsMain.asp" -->
<!--#include file="../inc/Ubb_Code.asp" -->
<%
Pl.GetWeb_Setting
dim ClassID,IncludeChild,SpecialID,ArticleNum,TitleMaxLen,ContentMaxLen,ShowType,ShowCols
dim ShowProperty,ShowClassName,ShowIncludePic,ShowTitle,ShowUpdateTime,ShowHits,ShowAuthor,ShowHot,ShowMore
dim Hot,Elite,DateNum,OrderField,OrderType,ImgWidth,ImgHeight
dim SystemPath,rs,sql,str,str1,topicLen,topic
dim i,FileType,SrtTitleMaxLen
dim tClass,trs,arrClassID
dim Author,AuthorName,AuthorEmail
ClassID=trim(request.querystring("ClassID"))
IncludeChild=trim(request.QueryString("IncludeChild"))
SpecialID=trim(request.querystring("SpecialID"))
ArticleNum=trim(request.querystring("ArticleNum"))
TitleMaxLen=trim(request.querystring("TitleMaxLen"))
ContentMaxLen=trim(request.querystring("ContentMaxLen"))
ShowType=trim(request.querystring("ShowType"))
ShowCols=trim(request.querystring("ShowCols"))
ShowProperty=trim(request.querystring("ShowProperty"))
ShowClassName=trim(request.querystring("ShowClassName"))
ShowIncludePic=trim(request.querystring("ShowIncludePic"))
ShowTitle=trim(request.querystring("ShowTitle"))
ShowUpdateTime=trim(request.querystring("ShowUpdateTime"))
ShowHits=trim(request.querystring("ShowHits"))
ShowAuthor=trim(request.querystring("ShowAuthor"))
ShowHot=trim(request.querystring("ShowHot"))
ShowMore=trim(request.querystring("ShowMore"))
Hot=trim(request.querystring("Hot"))
Elite=trim(request.querystring("Elite"))
DateNum=trim(request.querystring("DateNum"))
OrderField=trim(request.querystring("OrderField"))
OrderType=trim(request.querystring("OrderType"))
ImgWidth=trim(request.querystring("ImgWidth"))
ImgHeight=trim(request.querystring("ImgHeight"))
SystemPath="http://"&request.servervariables("server_name") & Pl.Web_Info(10)
if ShowType<>"" then
ShowType=Cint(ShowType)
else
ShowType=1
end if
if ShowCols<>"" then
ShowCols=Cint(ShowCols)
else
ShowCols=1
end if
if ContentMaxLen<>"" then
ContentMaxLen=Cint(ContentMaxLen)
else
ContentMaxLen=200
end if
if ClassID="" then
ClassID=0
else
ClassID=Clng(ClassID)
end if
if SpecialID="" then
SpecialID=0
else
SpecialID=Clng(SpecialID)
end if
sql="select"
if ArticleNum<>"" then sql=sql & " top " & Cint(ArticleNum)
if ShowClassName="true" then
sql=sql & " A.ArticleID,A.ClassID,C.ClassName,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,"
sql=sql & " A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A"
sql=sql & " inner join Pl_ArticleClass C on A.ClassID=C.ClassID where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
else
sql=sql & " A.ArticleID,A.ClassID,A.Title,A.Keyword,A.Author,A.CopyFrom,A.UpdateTime,A.Editor,A.Content,A.Hits,A.OnTop,A.Hot,A.Elite,A.Passed,A.IncludePic,A.Stars,A.PaginationType,A.ReadLevel,A.ReadPoint,A.DefaultPicUrl from Pl_Article A where A.Deleted="&FalseType&" and A.Passed="&TrueType&""
end if
'response.write "正常!"
if ClassID>0 then
set tClass=Pl.Execute("select ClassID,ParentPath,Child From Pl_ArticleClass where ClassID=" & ClassID)
if tClass.bof and tClass.eof then
response.write "document.write (" & Chr(34) & "找不到指定的栏目,可能已经被管理员删除!请重新生成JS调用代码。" & Chr(34) & ");"
response.end
else
if IncludeChild="true" then
if tClass(2)>0 then
arrClassID=tClass(0)
set trs=Pl.Execute("select ClassID from Pl_ArticleClass where ParentID=" & tClass(0) & " or ParentPath like '%" & tClass(1) & "," & tClass(0) & ",%' and Child=0 and LinkUrl=''")
do while not trs.eof
arrClassID=arrClassID & "," & trs(0)
trs.movenext
loop
set trs=nothing
sql=sql & " and A.ClassID in (" & arrClassID & ")"
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
else
sql=sql & " and A.ClassID=" & Clng(ClassID)
end if
end if
set tClass=nothing
end if
if SpecialID>0 then sql=sql & " and A.SpecialID=" & SpecialID
if ShowType=3 or ShowType=4 then sql=sql & " and A.DefaultPicUrl<>''"
if Hot="true" then sql=sql & " and A.Hits>=" & Clng(Pl.Web_Setting(14))
if Elite="true" then sql=sql & " and A.Elite="&TrueType&""
if DateNum<>"" then sql=sql & " and DATEDIFF('d',A.UpdateTime,Date())<=" & Cint(DateNum)
sql=sql & " order by A.OnTop asc"
if OrderField<>"" then
sql=sql & " ,A." & OrderField & ""
else
sql=sql & " ,A.ArticleID"
end if
if OrderType<>"" then
sql=sql & " " & OrderType & ""
else
sql=sql & " asc"
end if
set rs=server.createObject("Adodb.recordset")
rs.open sql,Conn,1,1
if rs.bof and rs.eof then
response.write "document.write (" & Chr(34) & "没有符合条件的信息" & Chr(34) & ");"
else
if ShowType=3 or ShowType=4 then
response.write "document.write (" & Chr(34) & "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center'>" & Chr(34) & ");" & vbcrlf
end if
do while not rs.eof
if TitleMaxLen<>"" then
SrtTitleMaxLen=Clng(TitleMaxLen)
else
SrtTitleMaxLen=50
end if
Author=rs("Author")
if instr(Author,"|")>0 then
AuthorName=left(Author,instr(Author,"|")-1)
AuthorEmail=right(Author,len(Author)-instr(Author,"|")-1)
else
AuthorName=Author
AuthorEmail=""
end if
if ShowType=1 or ShowType=2 then
str=""
else
str=""
end if
if ShowType=1 or ShowType=2 then
topic=Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen))
else
if ShowClassName="true" then
str=str & ""
else
str=str & "<div style='width:24%'><a href='" & SystemPath & "Article/ArticleShow.asp?ArticleID=" & rs("articleid") & "' title='品名:" & rs("Title") & "\n" & "价格:" & AuthorName & "元\n" & "更新时间:" & rs("UpdateTime") & "\n" & "点击次数:" & rs("Hits") & " ' target='_blank'><font color=red>"
end if
FileType=right(lcase(rs("DefaultPicUrl")),3)
if fileType="jpg" or fileType="bmp" or fileType="png" or fileType="gif" then
str=str & "<img src='" & ChkPicUrl(rs("DefaultPicUrl")) & "' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><br><b>"
else
str=str & "<img src='" & SystemPath & "images/NoPic2.jpg' width='" & ImgWidth & "' height='" & ImgHeight & "' border='0'><b>"
end if
str=str & Pl.GotTopic(rs("title"),Clng(SrtTitleMaxLen)) & "</font></b>"
str=str & "<br>价格:¥ " & AuthorName & " 元<br><img src=../htxs/cpxx.gif border=0 width=102 height=34></a><br></div>"
end if
str=str & ""
rs.movenext
if ShowType=3 or ShowType=4 then
i=i+1
if ((i mod ShowCols=0) and (not rs.eof)) then
str=str & ""
end if
end if
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
loop
if ShowType=1 or ShowType=2 then
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
else
str=""
str=str & "</td></tr></table>"
response.write "document.write (" & Chr(34) & str & Chr(34) & ");" & vbcrlf
end if
end if
rs.close
set rs=nothing
'call CloseConn()
Function ChkPicUrl(PicUrl)
If IsEmpTy(Trim(PicUrl)) then
ChkPicUrl=SystemPath & "images/NoPic.Gif"
else
PicUrl=lcase(Trim(PicUrl))
If left(PicUrl,7)="http://" then
ChkPicUrl=PicUrl
ElseIf left(PicUrl,9)="{$webdir}" then
ChkPicUrl=Replace(PicUrl,"{$webdir}",SystemPath)
Else
ChkPicUrl=Replace(SystemPath & PicUrl,"{$webdir}",Pl.Web_Info(10))
End if
End if
End Function
%>
展开全部
你的代做衫码不全,最好把你的全部源码都给我以下,不然看不到效果,但是如果是要让结果以表格的形式输出,并且实现N行N列的效果,在asp中那最简单的就是加入一个嵌套循环语句,大家都知道,在html语句中<tr>就是一行,<td>就是一列,那么循环思路如下:
设置变量并赋值
dim i,ii
i=1
ii=1
do while not rs.eof '循环开始
---尺磨-这里就是循环体的内容---
if int(i/4)>=ii then '这里的数值4就是每行显示的数目
response.Write"<tr>" '如果大于4的整数倍就插入一行,作为新的开始
ii=ii+1 '将分行标记加1
end if
rs.movenext
i=i+1
loop
这是分行显示的代码,基本上就这样,测试通过,只需改变“int(i/4)>=ii ”里面的数字4就可以实现每行显示数目的控制,简便实用,呵呵!
如有不明白的陵胡斗给我留言,我帮你改改!
设置变量并赋值
dim i,ii
i=1
ii=1
do while not rs.eof '循环开始
---尺磨-这里就是循环体的内容---
if int(i/4)>=ii then '这里的数值4就是每行显示的数目
response.Write"<tr>" '如果大于4的整数倍就插入一行,作为新的开始
ii=ii+1 '将分行标记加1
end if
rs.movenext
i=i+1
loop
这是分行显示的代码,基本上就这样,测试通过,只需改变“int(i/4)>=ii ”里面的数字4就可以实现每行显示数目的控制,简便实用,呵呵!
如有不明白的陵胡斗给我留言,我帮你改改!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
朋友,你的帆信笑雹include文件没有,我无法运行,如果需要帮忙就把整个代码发给我。。态升轮我QQ16194122。需要看到才可以帮你啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
现在看不到你的样子?!又不知道你想要什么样子的!
给我留言,我帮你看看!
给我留言,我帮你看看!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询