html 简单的Javascript循环遍历多个网页。这可以在电视上显示。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 简单的Javascript循环遍历多个网页。这可以在电视上显示。相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Dashboard Example</title>
<style type="text/css">
body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
iframe { border: none; width: 100%; height: 100%; display: none; }
iframe.active { display: block;}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
var Dash = {
    nextIndex: 0,

    //Don't put too many items in this list
    dashboards: [
        {url: "http://ur1.com", time: 600, refresh: true},
        {url: "http://ur2.com", time: 60, refresh: true},
        {url: "http://ur3.com", time: 10, refresh: true}
    ],

    startup: function () {
        for (var index = 0; index < Dash.dashboards.length; index++) {
						Dash.loadFrame(index);
				}
        setTimeout(Dash.display, Dash.dashboards[0].time * 1000);
    },

    loadFrame: function (index) {
				var iframe = document.getElementById(index);
				iframe.src = Dash.dashboards[index].url;
    },

    display: function () {
        var dashboard = Dash.dashboards[Dash.nextIndex];
				Dash.hideFrame(Dash.nextIndex - 1);
				if (dashboard.refresh) {
						Dash.loadFrame(Dash.nextIndex);
				}
				Dash.showFrame(Dash.nextIndex);
        Dash.nextIndex = (Dash.nextIndex + 1) % Dash.dashboards.length;
        setTimeout(Dash.display, dashboard.time * 1000);
    },

    hideFrame: function (index) {
				if (index < 0) {
						index = Dash.dashboards.length - 1;
				}
				$('#'+index).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0.0},2000);
				setTimeout(function() {true;},2000);
				document.getElementById(index).removeAttribute('class');
    },

    showFrame: function (index) {
				$('#'+index).css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0},200);
				document.getElementById(index).setAttribute('class', 'active');
    }
};
function fetchPage(url) {
    $.ajax({
        type: "GET",
        url: url,
        error: function(request, status) {
            alert('Error fetching ' + url);
        },
        success: function(data) {
            parse_hadoop_active_nodes(data.responseText);
        }
    });
}

function parse(data) {
    alert($(data).find("#nodes").text());
}

window.onload = Dash.startup;
</script>
</head>
<body>
<iframe id="0" class="active"></iframe>
<iframe id="1"></iframe>
<iframe id="2"></iframe>
<iframe id="3"></iframe>
</body>
</html>

以上是关于html 简单的Javascript循环遍历多个网页。这可以在电视上显示。的主要内容,如果未能解决你的问题,请参考以下文章

javascript ,遍历数组 ,一次循环删除多个元素

javascript ,遍历数组 ,一次循环删除多个元素

javascript 数组遍历,几种循环方式的比较。

html JavaScript:使用jQuery连续循环遍历子项

如何在 Javascript 中循环遍历 HTML 表中的复选框行

JavaScript中循环遍历JSON响应!