写了一段无缝滚动的代码,但是一直不对,在网上查了一下后,仿照着修改了一下,果然就可以了,但是有个问题一直想不通,代码中有这么一句var origin = scrollArea.scrollTop++; 把scrollArea.scrollTop的值赋给origin后,scrollArea.scrollTop就自增了,那么origin应该是不会等于scrollArea.scrollTop,那怎么会执行if(origin == scrollArea.scrollTop)这个条件呢?希望前辈们能指点一下,谢谢了!!代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>scoll</title>
<style type="text/css">
#scrollArea{
height:60px;
overflow:hidden;
border:1px solid red;
}
</style>
</head><body>
<div id="scrollArea">
<p>滚动新闻一</p>
<p>滚动新闻二</p>
<p>滚动新闻三</p>
<p>滚动新闻四</p>
<p>the end</p>
</div>
<script type="text/javascript">
var scrollArea = document.getElementById("scrollArea");
var scrollingInterval;
function doScolling(){
scrollingInterval = setInterval("scrolling()",50);
}
function scrolling()
{
var reachedBottom=false;
var bottom;
var origin = scrollArea.scrollTop++; 
if(origin == scrollArea.scrollTop)

if(!reachedBottom)
{  
scrollArea.innerHTML+=scrollArea.innerHTML;
reachedBottom=true;
bottom=origin;
}
else
{
   scrollArea.scrollTop=bottom; 
}
}
scrollArea.onmouseover=function()
{
clearInterval(scrollingInterval);
}
scrollArea.onmouseout=function()
{
scrollingInterval = setInterval("scrolling()",50);
}
}
window.onload=doScolling;
</script>
</body>
</html>