这个是一段新闻发布系统的代码, 不过这段代码只能显示出一列新闻来,谁来教我能把新闻分成两列显示出来啊???? 我改了一点代码,能显示出两列的新闻来,但是,这两列的新闻显示的都是一样的!! 郁闷~~~~~~~~~~~~~~~~~~~~!!!(我只在后台添加了新闻大类(新闻一级分类),小类(新闻二级分类)没有添加)
还有就是能够显示新闻的同时,如果这个新闻标题太长的话,能够用...来表示。
javastr=""
javastr=javastr+"<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"
<!--#include file="conn.asp"-->
<%
owen=request("owen")
owen1=request("owen1")
owen2=request("owen2")
n=request("n")
if n="" then
n=100
end if%>
<%
if owen1<>"" and owen2<>"" then
sql="select top 6 * from NEWS where BigClassName='"& owen1 &"' and SmallClassName='"& owen2 &"' order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"<img src="../Images/dot.gif"> <span style=\"font-size:9pt;line-height:15pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=left(rs("title"),12)%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%
rs.close
set rs=nothing
%>
document.write (javastr)
<%
ElseIf owen2<> "" then
sql="select top 6 * from NEWS where SmallClassName='"& owen2 &"' order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎ <span style=\"font-size:9pt;line-height:15pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=left(rs("title"),12)%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%
rs.close
set rs=nothing
%>
document.write (javastr)
<%
ElseIf owen1<>"" then
sql="select top 6 * from NEWS where BigClassName='"& owen1 &"' order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎ <span style=\"font-size:9pt;line-height:15pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=rs("title")%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"<td width=\"20\"> </td>"
javastr=javastr+"<td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎ <span style=\"font-size:9pt;line-height:15pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=rs("title")%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%
rs.close
set rs=nothing
%>
document.write (javastr)
<% End If %>
<%
if owen1= "" and owen2= "" then
sql="select top 6 * from NEWS order by id desc"
set rs=conn.execute(sql)
do while not rs.eof
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎ <span style=\"font-size:9pt;line-height:15pt\"><% if rs("imagenum")<>"0" then response.write "<img src='images/news.gif' border=0 alt='图片新闻'>" end if %><a href=\"onews.asp?id=<%=rs("id")%>\" title=\"<%=rs("title")%>\" target=\"_blank\"><%=left(rs("title"),12)%></a></span> <font color=\"#999999\" >[<%=rs("infotime")%>]</font> <font color=\"#999999\" >(阅读<font color=\"#FF0000\" ><%=rs("hits")%></font>次)</font>"
javastr=javastr+"</td></tr>"
<%n=n-1
if n<1 then exit do
rs.movenext
loop
%>
javastr=javastr+"</table>"
<%rs.close
set rs=nothing
conn.close
set conn=nothing%>
document.write (javastr)
<%end if%>