JS实现网页轮播(每隔5秒切换)

原创
08/04 16:48
阅读数 35
 function onload() {
              <%=sb_js_onload.ToString() %> 
              var timer = setInterval("jump_url()", 1000);
        }
        var arrurl = ["screen.aspx?code=001", "screen.aspx?code=002"];
        var time = 5;
        var idx = 0;
        var curPath = window.document.location.href;
        var localhostPaht = curPath.substring(curPath.lastIndexOf('/') + 1);
        function jump_url() {
            time--;

            if (time == 0) {
                //clearInterval(timer);
                if (arrurl[0] == localhostPaht || localhostPaht == "screen.aspx") {
                    idx++;
                    location.href = arrurl[idx];
                }
                else {
                    idx = arrurl.indexOf(localhostPaht);
                    idx++;
                    if (idx >= arrurl.length) {
                        idx = 0;
                    }
                    location.href = arrurl[idx];
                }
                time = 5;
            }
           
        }

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
在线直播报名
返回顶部
顶部