自动滚动到达页面底部后,如何在页面中循环 url 数组?

how can I loop url arrays in a page after the autoscroll hits the bottom part of the page?

<body>
<div id="scr" style="overflow:auto; width: 100%; height: 100%; ">
    <p id="content"></p>
</div>

var 站点 = ['linkexample.com', 'http://link2.com', 'http://link3.com'];

 i = 3;
 ctr = 0;
 while(ctr < i){
document.getElementById("content").innerHTML = '<object width="100%" height="100%" data="' + sites[ctr] + '"></object>';

function ScrollDiv(){
   if(document.getElementById('scr').scrollTop<(document.getElementById('scr').scrollHeight-document.getElementById('scr').offsetHeight)){-1
         document.getElementById('scr').scrollTop=document.getElementById('scr').scrollTop+1
         }

   else {
         ctr++;
        }

setInterval(ScrollDiv, 5) }

};

此代码示例遍历数组并将 url 加载到 <p id="content"></p>

我还纠正了您代码中的一些错误。

<!DOCTYPE html>
<html>
<head>
  <title></title>
  <style type="text/css">

  </style>
</head>
<body>
            <div id="scr" style="overflow:auto; width: 100%; height: 100%; ">
                <p id="content"></p>

            </div>
</body>
<script type="text/javascript">

var ctr = 0;

var sites = ['http://link1.com', 'http://link2.com', 'http://link3.com'];  
function ScrollDiv(){
    if(document.getElementById('scr').scrollTop<(document.getElementById('scr').scrollHeight-document.getElementById('scr').offsetHeight)){
        document.getElementById('scr').scrollTop=document.getElementById('scr').scrollTop+1;
    }else{
        ctr++;
        if(ctr>2){
            ctr=0;
        }
        document.getElementById("content").innerHTML = '<object width="100%" height="100%" data="' + sites[ctr] + '"></object>';
    }
}

setInterval(ScrollDiv, 3000);

</script>
</html>

您提供的示例中没有页面内容。我不清楚你想用卷轴做什么。