利用层实现具体新闻分页显示

 <!--#include file="zheboconn.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>利用层实现具体新闻分页显示</title>
<style type="text/css">
<!--
#frameContent{
    width:873px;                /*调整显示区的宽*/
    height:490px;               /*调整显示区的高*/
    font-size:14px;
    line-height:20px;
    overflow-y:hidden;
}
#apDiv1 {
 position:absolute;
 left:0px;
 top:0px;
 width:1024px;
 height:768px;
 z-index:1;
}
#apDiv2 {
 position:absolute;
 left:21px;
 top:209px;
 width:873px;
 height:490px;
 z-index:2;
}
.STYLE3 {
 font-size: 15px;
 font-family: "宋体";
 color: #000000;
    line-height:25px;
}
img{border:none}
-->
</style>
</head>

<body scroll="no" >
<div id="apDiv1"><img src="images/321.jpg" width="1024" height="768" border="0" />
</div>
<div id="pages" style="font-size:12px; position:absolute; Top:279px; left:902px; z-index: 1; width:auto; height:auto"></div>
<div id="apDiv2">
<div id="frameContent">
  <table width="97%" border="0" align="center" scroll="no">
    <tr>
      <td height="35" valign="top">
        <span class="STYLE3">
        <%
id=cint(trim(replace(request("id"),"'","")))  
strquery = "select * from  表名 where id="&id
set rs = conn.execute(strquery)
if not rs.bof then
%>
        <br>
        </span>
        <table width="100%" height="26">
<%
do while not rs.eof
%>
<tr>
<td height="20" align="center" valign="middle" class="STYLE3"><strong><%=rs("title")%></strong></td>
</tr>
<tr> <td height="20" align="center" valign="middle" class="STYLE3">开始时间:<%=rs("starttime")%> 结束时间:<%=rs("endtime")%> </td></tr> 
<tr> <td height="20" class="STYLE3"><%=rs("content")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
        <span class="STYLE3">
        <%
else
response.write("无数据.")
end if
rs.close
conn.close
set adodataconn = nothing
set rsemaildata = nothing

%>       
        </span></td>
    </tr>
  </table>
</div>
<P>
<script language="javascript">
var obj = document.getElementById("frameContent");  //获取内容层
var pages = document.getElementById("pages");         //获取翻页层
var pgindex=1;  
var allp = 0;

window.onload = function()                             //重写窗体加载的事件
{
    var allpages = Math.ceil(parseInt(obj.scrollHeight)/parseInt(obj. offsetHeight));//获取页面数量
 allp  = allpages;
   // pages.innerHTML = "<b>共"+allpages+"页</b>";     //输出页面数量
    for (var i=1;i<=allpages;i++){
      //  pages.innerHTML += "<a href=/"javascript:showPage('"+i+"');/">第"+i+"页</a> ";
//循环输出第几页
    }
 pages.innerHTML += " <a href=/"javascript:gotopage('-1');/" onFocus=this.blur()><img src=images/s1.gif border=0/></a></br></br></br></br></br></br><a href=/"notification.asp/" onFocus=this.blur()><img src=images/f1.gif border=0/></a></br></br></br></br></br></br><a href=/"javascript:gotopage('1');/" onFocus=this.blur()><img src=images/x.gif border=0/></a>" 
}
function gotopage(value){
try{
 value=="-1"?showPage(pgindex-1):showPage(pgindex+1);
 }catch(e){
 
 }
}
function showPage(pageINdex)
{
    obj.scrollTop=(pageINdex-1)*parseInt(obj.offsetHeight);         //根据高度,输出指定的页
pgindex=pageINdex;
//alert(allp);监听的弹出窗口,监听第几页
if(pgindex<1)
 pgindex=1;
else if(pgindex >allp)
 pgindex=allp;
}
</script>
</div>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值