网站左侧列表新闻数量太长,怎么缩短为十个

上帝的苹果 2013-07-25 03:56:54
<%sub dhl()%>
<h2>产品系列</h2>

<%
Set rs1=server.CreateObject("adodb.recordset")
sql1="Select * From 0791idc_ProductClass where Classid<>3 and ParentPath='0' order by ClassID"
rs1.open sql1,conn,1,1
j=1
do while not rs1.eof
%>
<div class="jjT"><h3><a href="Product.html"><%=rs1("ClassName") %></a></h3></div>
<div class="jjT1">
<%
Dim rs2,sql2,g,count
Set rs2=server.CreateObject("adodb.recordset")
sql2="select * from 0791idc_Product where ClassID="&rs1("ClassID")
rs2.open sql2,conn,1,1
if rs2.recordcount=0 then
response.write ("  暂无分类!")
end if
g=1
count=1
do while not rs2.eof%>
<div class="jj"><a href="ProductShow-<%= rs2("ID") %>.html"><%
response.Write rs2("Title")

%> </a></div>


<% rs2.movenext
count=count+1
g=g+1
loop
rs2.close
set rs2=nothing %>
</div>
<% rs1.movenext
j=j+1
loop
rs1.close
set rs1=nothing
%>
<%
Set rs1=server.CreateObject("adodb.recordset")
sql1="Select * From 0791idc_ProductClass where Classid=3 and ParentPath='0'"
rs1.open sql1,conn,1,1
j=1
do while not rs1.eof
%>
<div class="jjT"><h2><%=rs1("ClassName") %></h2></div>
<div class="jjT1">
<%

Set rs2=server.CreateObject("adodb.recordset")
sql2="select * from 0791idc_Product where ClassID="&rs1("ClassID")
rs2.open sql2,conn,1,1
if rs2.recordcount=0 then
response.write ("  暂无分类!")
end if
g=1
count=1
do while not rs2.eof%>
<div class="jjj"><a href="ProductShow-<%= rs2("ID") %>.html"><%
response.Write rs2("Title")

%> </a></div>


<% rs2.movenext
count=count+1
g=g+1
loop
rs2.close
set rs2=nothing %>
</div>
<% rs1.movenext
j=j+1
loop
rs1.close
set rs1=nothing
%>
<%end sub%>
<%sub jianjie(id)%>
<%sql="select * from 0791idc_Aboutus where id="&id
set rs=conn.execute(sql)

if not rs.eof then

%>
<a href="Aboutus-1.html"><%=left(rs("content"),300)%></a>
<%else
response.Write"暂时没有"
end if
rs.close
set rs=nothing
%>
<%end sub%>
<%sub dhll()%>
<h2>产品系列</h2>

<%
Set rs1=server.CreateObject("adodb.recordset")
sql1="Select * From 0791idc_ProductClass where ClassID<>3 and ParentPath='0' order by ClassID"
rs1.open sql1,conn,1,1
j=1
do while not rs1.eof
%>
<div class="jjT"><h3><a href="Product.html"><%=rs1("ClassName") %></a></h3></div>
<div class="jjT1">
<%
Dim rs2,sql2,g,count
Set rs2=server.CreateObject("adodb.recordset")
sql2="select * from 0791idc_Product where ClassID="&rs1("ClassID")
rs2.open sql2,conn,1,1
if rs2.recordcount=0 then
response.write ("  暂无分类!")
end if
g=1
count=1
do while not rs2.eof%>
<div class="jj"><a href="ProductShow-<%= rs2("ID") %>.html"><%
response.Write rs2("Title")

%> </a></div>


<% rs2.movenext
count=count+1
g=g+1
loop
rs2.close
set rs2=nothing
%>
</div>
<% rs1.movenext
j=j+1
loop
rs1.close
set rs1=nothing
%>
<%
Set rs1=server.CreateObject("adodb.recordset")
sql1="Select * From 0791idc_ProductClass where Classid=3 and ParentPath='0'"
rs1.open sql1,conn,1,1
j=1
do while not rs1.eof
%>
<div class="jjT"><h2><%=rs1("ClassName") %></h2></div>
<div class="jjT1">
<%

Set rs2=server.CreateObject("adodb.recordset")
sql2="select * from 0791idc_Product where ClassID="&rs1("ClassID")
rs2.open sql2,conn,1,1
if rs2.recordcount=0 then
response.write ("  暂无分类!")
end if
g=1
count=1
do while not rs2.eof%>
<div class="jjj"><a href="ProductShow-<%= rs2("ID") %>.html"><%
response.Write rs2("Title")

%> </a></div>


<% rs2.movenext
count=count+1
g=g+1
loop
rs2.close
set rs2=nothing %>
</div>
<% rs1.movenext
j=j+1
loop
rs1.close
set rs1=nothing
%>
<h2>最新文章</h2>
<%

BigClass="行业知识"
Set rss=Server.CreateObject("ADODB.RecordSet")
sql="select * from 0791idc_news where BigClassName='"&BigClass&"' order by AddDate desc"
rss.Open sql,conn,1,1
if not rss.eof then
do while not rss.eof
%>
<div class="lis">·<% If ISHTML = 1 Then
AutoLink = ""&NewName&""&Separated&""&rss("ID")&"."&HTMLName&""
Else
AutoLink = "shownews.asp?ID="&rss("ID")&""
End If
Response.Write "<a href="""&AutoLink&""">"&rss("TITLE")&"</a>"&VbCrLf

%></div>

<%
rss.movenext
loop
end if
rss.close
set rss=nothing
%>
<%end sub%>
<%sub jianjie(id)%>
<%sql="select * from 0791idc_Aboutus where id="&id
set rs=conn.execute(sql)

if not rs.eof then

%>
<a href="Aboutus-1.html"><%=left(rs("content"),300)%></a>
<%else
response.Write"暂时没有"
end if
rs.close
set rs=nothing
%>
<%end sub%>

<%sub rongy(BigClassName,num)%>
<%
sql="select top "&num&" * from 0791idc_news where BigClassName='"&BigClassName&"'order by addDate desc"
set rs=conn.execute(sql)
if not rs.eof then
If ISHTML = 1 Then
AutoLink = ""&NewName&""&Separated&""&rs("ID")&"."&HTMLName&""
Else
AutoLink = "shownews.asp?ID="&rs("ID")&""
End If
do while not rs.eof
%>
<div class="ryt">
<h3><a href="<%=AutoLink%>"><img src="<%=rs("FirstImageName")%>" border="0" width="124px" height="89px" alt="<%=rs("Title")%>" title="<%=rs("Title")%>" /></a></h3><p><a href="<%=AutoLink%>"><%=rs("Title")%></a></p>
</div>
<%
rs.movenext
loop
else
response.Write"暂时没有"
end if
rs.close
set rs=nothing
%>
<%end sub%>

<%sub gongyi(BigClassName,num)%>
<%
sql="select top "&num&" * from 0791idc_news where BigClassName='"&BigClassName&"'order by addDate desc"
set rs=conn.execute(sql)
if not rs.eof then
do while not rs.eof
title=len(rs("Title"))
If ISHTML = 1 Then
AutoLink = ""&NewName&""&Separated&""&rs("ID")&"."&HTMLName&""
Else
AutoLink = "shownews.asp?ID="&rs("ID")&""
End If
if Title>16 then
%>


<li>·<a href="<%=AutoLink%>"><%=left(rs("Title"),16)%>...</a></li>
<%else%>
<li>·<a href="<%=AutoLink%>"><%=rs("Title")%></a></li>
<%end if%>
<%
rs.movenext
loop
else
response.Write"暂时没有"
end if
rs.close
set rs=nothing
%>
<%end sub%>


<%sub product(num)%>
<%
sql="select top "&num&" * from 0791idc_Product where FirstPage=true order by UpdateTime asc"

set rs=conn.execute(sql)
if not rs.eof then
do while not rs.eof
%>

<div class="tt"><h3><a href="ProductShow-<%= rs("ID") %>.html"><img src="<%=rs("DefaultPicUrl")%>" width="165px" alt="<%=rs("title")%>" height="160px" border="0"title="<%=rs("title")%>" /></a></h3><p align="center" style=" height:20px"><a href="ProductShow-<%= rs("ID") %>.html"><%=rs("title")%></a></p></div>

<%
rs.movenext
loop
else
response.Write"暂时没有"
end if
rs.close
set rs=nothing
%>
<%end sub%>

<%sub hangye(BigClassName,num)%>
<%
sql="select top "&num&" * from 0791idc_news where BigClassName='"&BigClassName&"'order by addDate desc"
set rs=conn.execute(sql)
if not rs.eof then
do while not rs.eof
title=len(rs("Title"))
If ISHTML = 1 Then
AutoLink = ""&NewName&""&Separated&""&rs("ID")&"."&HTMLName&""
Else
AutoLink = "shownews.asp?ID="&rs("ID")&""
End If
if Title>16 then

%>
<div class="list"><span><%=year(rs("AddDate"))%>-<%=month(rs("AddDate"))%>-<%=day(rs("AddDate"))%></span>·<a href="<%=AutoLink%>"><%=left(rs("Title"),16)%>...</a></div>
<%else%>
<div class="list"><span><%=year(rs("AddDate"))%>-<%=month(rs("AddDate"))%>-<%=day(rs("AddDate"))%></span>·<a href="<%=AutoLink%>"><%=rs("Title")%></a></div>
<%end if%>
<%
rs.movenext
loop
else
response.Write"暂时没有"
end if
rs.close
set rs=nothing
%>
<%end sub%>

<%function fll()%>

<div id="idPicShow" class="container">
<ul id="idNum">
</ul>
</div>
<div id="idPicText"></div>
<div id="idPicList"></div>

<script>
var rvt = new RevealTrans("idPicShow");

//添加变换对象
<%
set rs1=conn.execute("select top 5 * from 0791idc_news where BigClassName='发货现场' order by addDate desc")
if not rs1.eof or not rs1.Bof then
If ISHTML = 1 Then
AutoLink = ""&NewName&""&Separated&""&rs1("ID")&"."&HTMLName&""
Else
AutoLink = "shownews.asp?ID="&rs1("ID")&""
End If
%>
<%
do while not rs1.eof
%>
rvt.Add('<%=rs1("FirstImageName")%>', '', '<%=AutoLink%>');
<%
rs1.movenext
loop
else
%>
rvt.Add('images/logo.gif', '', '');
<%
end if
rs1.close
set rs1=nothing
%>
var oList = $("idPicList"), oText = $("idPicText"), arrImg = [];

var oNum = $("idNum"), arrNum = [];

//设置图片列表
Each(rvt.List, function(list, i){
//图片式
var img = document.createElement("img");
img.src = list["img"]; img.alt = list["text"];
arrImg[i] = img;
oList.appendChild(img);
//按钮式
var li = document.createElement("li");
li.innerHTML = i + 1;
arrNum[i] = li;
oNum.appendChild(li);
//事件设置
img.onmouseover = li.onmouseover = function(){ rvt.Auto = false; rvt.Index = i; rvt.Start(); };
img.onmouseout = li.onmouseout = function(){ rvt.Auto = true; rvt.Start(); };
});

//设置图片列表样式 文本显示区域
rvt.onShow = function(){
var i = this.Index, list = this.List[i];
//图片式
Each(arrImg, function(o){ o.className = ""; }); arrImg[i].className = "on";
//按钮式
Each(arrNum, function(o){ o.className = ""; }); arrNum[i].className = "on";
//文本区域
oText.innerHTML = !!list.url ? "<a href='" + list.url + "' target='_blank'>" + list.text + "</a>" : list.text;
}

//文本显示区域
oText.onmouseover = function(){ rvt.Auto = false; rvt.Stop(); };
oText.onmouseout = function(){ rvt.Auto = true; rvt.Start(); };

rvt.Start();

</script>
<%end function%>
...全文
132 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
上帝的苹果 2013-07-25
  • 打赏
  • 举报
回复
引用 7 楼 lhb8801 的回复:
你不需要乱改,只需要改的是你读取新闻列表的那个查询语句,
明白了。谢谢。非常感谢
lhb8801 2013-07-25
  • 打赏
  • 举报
回复
你不需要乱改,只需要改的是你读取新闻列表的那个查询语句,
lhb8801 2013-07-25
  • 打赏
  • 举报
回复
引用 5 楼 slydhaw1314 的回复:
[quote=引用 1 楼 lhb8801 的回复:] 查询的时候限制一下 select top 10 * from 新闻表 where ......
能说的详细些吗,小白不会。或者帮忙直接改出来。是想缩短新闻数量,左侧列表列出了所有的新闻,想只列出十个。谢谢[/quote] 这么说吧 你不是有 sql="select top "&num&" * from 0791idc_news where BigClassName='"&BigClassName&"'order by addDate desc" 你只需要改成sql="select top 10 * from 0791idc_news where BigClassName='"&BigClassName&"'order by addDate desc" 其他的没有 top 10 的 只需要在select 后面加上 top 10
上帝的苹果 2013-07-25
  • 打赏
  • 举报
回复
引用 1 楼 lhb8801 的回复:
查询的时候限制一下 select top 10 * from 新闻表 where ......
能说的详细些吗,小白不会。或者帮忙直接改出来。是想缩短新闻数量,左侧列表列出了所有的新闻,想只列出十个。谢谢
lhb8801 2013-07-25
  • 打赏
  • 举报
回复
引用 3 楼 slydhaw1314 的回复:
不是标题数,是信息数量。网站左侧列表列出了所有的新闻,想只显示十条新闻
那就是按照我上面写的 第一个回复 你把你想变成10个的 换成 select top 10 * from.....
上帝的苹果 2013-07-25
  • 打赏
  • 举报
回复
不是标题数,是信息数量。网站左侧列表列出了所有的新闻,想只显示十条新闻
lhb8801 2013-07-25
  • 打赏
  • 举报
回复
如果是你说的新闻标题字数 可以这样 在读取的时候 <%LeftStr Rs("title"),10%> 或者 <%= left(rs("title"),10) %>
lhb8801 2013-07-25
  • 打赏
  • 举报
回复
查询的时候限制一下 select top 10 * from 新闻表 where ......

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧