| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 741 人关注过本帖
标题:[求助]新闻发布系统的问题,代码在里面,来看一下! 谢谢!
只看楼主 加入收藏
only_cl
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-17
结帖率:0
收藏
 问题点数:0 回复次数:8 
[求助]新闻发布系统的问题,代码在里面,来看一下! 谢谢!

这个是一段新闻发布系统的代码, 不过这段代码只能显示出一列新闻来,谁来教我能把新闻分成两列显示出来啊???? 我改了一点代码,能显示出两列的新闻来,但是,这两列的新闻显示的都是一样的!! 郁闷~~~~~~~~~~~~~~~~~~~~!!!(我只在后台添加了新闻大类(新闻一级分类),小类(新闻二级分类)没有添加)
还有就是能够显示新闻的同时,如果这个新闻标题太长的话,能够用...来表示。
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">&nbsp;<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+"◎&nbsp;<span style=\&quot;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+"◎&nbsp;<span style=\&quot;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\">&nbsp;</td>"
javastr=javastr+"<td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎&nbsp;<span style=\&quot;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+"◎&nbsp;<span style=\&quot;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%>

图片附件: 游客没有浏览图片的权限,请 登录注册

搜索更多相关主题的帖子: 新闻发布 系统 代码 
2007-05-17 09:48
only_cl
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-17
收藏
得分:0 
顶上来,~~~~~~! 大家来看看!   帮帮忙! 谢谢~~~!
2007-05-17 09:49
only_cl
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-17
收藏
得分:0 
帮下忙,谢谢~~~~~!
2007-05-17 09:58
only_cl
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-17
收藏
得分:0 
为什么没有人来啊?????  在线等,  ~~~~~~~~~~~~~~~~~~~~
2007-05-17 10:11
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

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">&nbsp;<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
For n=1 To 2
IF Rs.Eof then Exit For
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎&nbsp;<span style=\&quot;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>"
<%
rs.movenext
Next
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
For n=1 To 2
IF Rs.Eof then Exit For
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎&nbsp;<span style=\&quot;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></tr>"
<%
rs.movenext
Next
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
For n=1 To 2
IF Rs.Eof then Exit For
%>
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎&nbsp;<span style=\&quot;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>"
<%
rs.movenext
Next
loop
%>
javastr=javastr+"</table>"
<%rs.close
set rs=nothing
conn.close
set conn=nothing%>
document.write (javastr)
<%end if%>

[此贴子已经被作者于2007-5-17 10:30:53编辑过]


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-05-17 10:24
only_cl
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-17
收藏
得分:0 

还是不行~~~~~~~~~~~~~~~~~~~!
没有反映啊~

2007-05-17 10:34
only_cl
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-17
收藏
得分:0 
javastr=javastr+"<tr><td height=\"24\" style=\"BORDER-bottom: #999999 1px dotted\">"
javastr=javastr+"◎&nbsp;<span style=\&quot;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></tr>"

这段代码好象是 设置显示新闻的代码!!! 我试 过, 改了点东西,就显示不出来~~~~
2007-05-17 10:39
only_cl
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-17
收藏
得分:0 
代码过长, 大家辛苦一下啊~~~~~~
2007-05-17 11:18
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 

如果是自动转行你这样写应该是对的,如果是你觉的太长,人为转行的话,每段开头加上javastr=javastr+"

2007-05-17 12:50
快速回复:[求助]新闻发布系统的问题,代码在里面,来看一下! 谢谢!
数据加载中...
 
   



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

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