神奇宝贝第五部xy目录:怎样实现滚动字幕的首尾相接

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 03:39:04

<HTML>
<HEAD>
<META http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE>不间断文字向上滚动+鼠标悬停</TITLE>
</HEAD>
<BODY >
<!-- start ------------------------------------------------------------>
相对定位版不间断滚动:<br><br>
<div style="width:200px;height:150px;overflow:hidden">
<table cellspacing=0 cellpadding=5 bgcolor=#F8F8F8 style="position:relative;top:0px;width:200px;table-layout:fixed" id=news>
<tbody>
<tr>
<td valign=top height=150>
<b>新闻一</b><br>
新闻内容<br>
新闻内容<br>
新闻内容<br>
新闻内容<br>
新闻内容<br>
新闻内容<br>
新闻内容<br>
</td>
</tr>
</tbody>
<script language=javascript>
//重复一次新闻内容
document.write(news.tBodies[0].innerHTML)
</script>
</table>
</div>
<script language=javascript>
//实现不间断滚动
function newsScroll(){news.style.pixelTop=(news.style.pixelTop-1)%(news.clientHeight/2);}
var s=50;
timer1=setInterval('newsScroll()',s) //更改第二个参数可以改变速度,值越小,速度越快
news.onmouseover=function(){clearInterval(timer1)}
news.onmouseout=function(){timer1=setInterval('newsScroll()',s)}
</script>
<!-- end -------------------------------------------------------------->
</BODY>
</HTML>

<body>
<div style="width:200px;height:150px;overflow:hidden" onmouseover="try{clearTimeout(timer1)}catch(e){;}" onmouseout="timer1=setInterval('newsScroll()',10)">
<table cellspacing=0 cellpadding=5 bgcolor=#F8F8F8 style="position:relative;top:0px;width:200px;table-layout:fixed" id=news>
<tbody>
<tr>
<td valign=top height=150>
<b>新闻一</b><br>
</td>
</tr>
<tr>
<td valign=top height=150>
<b>新闻二</b><br>
</td>
</tr>
<tr>
<td valign=top height=150>
<b>新闻三</b><br>
</td>
</tr>
</tbody>
<script language=javascript>
//重复一次新闻内容
document.write(news.tBodies[0].innerHTML)
</script>
</table>
</div>

<script language=javascript>
//实现不间断滚动
function newsScroll()
{
scrollTop1.value=news.scrollTop;
scrollHeight1.value=news.scrollHeight;
offsetTop1.value=news.offsetTop;
offsetHeight1.value=news.offsetHeight;
top1.value=news.style.top;
client1.value=news.clientTop;
clienth1.value=news.clientHeight;
pixel1.value=news.style.pixelTop;
news.style.pixelTop=(news.style.pixelTop-1)%(news.clientHeight/2);
}
timer1=setInterval('newsScroll()',10) //更改第二个参数可以改变速度,值越小,速度越快。
</script>
<nobr>news.scrollTop:<input type=text id="scrollTop1">news.scrollHeight:<input type=text id="scrollHeight1"><br>news.offsetTop<input type=text id="offsetTop1">news.offsetHeight:<input type=text id="offsetHeight1"><br>news.style.top:<input type=text id="top1">news.clientTop:<input type=text id="client1"><br>news.clientHeight:<input type=text id="clienth1">news.style.pixelTop:<input type=text id="pixel1"></nobr>
</body>