我这里有一个重复的页面加载功能,自动加载随机页面
<script>
var interval = 5; // in seconds
var pages = [
'http://example.com/index.php',
'http://example.com/about.php',
'http://example.com/services.php',
'http://example.com/portfolio.php',
'http://example.com/career.php',
'http://example.com/contacts.php'
];
var current_page_index = 0;
setInterval(function() {
loadintoIframe('myframe', pages[current_page_index]);
current_page_index = (current_page_index + 1) % pages.length;
}, interval * 1000); // second setInterval param is milliseconds
</script>
工作正常,但我想它的装载模式更改为随机。现在它正在加载,因为它是在一个模式中给出的。我的意思是它将首先加载'http://example.com/index.php'然后'http://example.com/about.php'那样。
如何向其添加随机效果?有人帮我请....
这个问题的Load different pages with in a single iframe
添加随机效应或随机页?你想要什么? –
@ dholakiyaankit-我想在页面加载的随机效果....现在它加载在一个模式,这是在顺序给出。现在我想要一个随机效果,意味着,第一次加载http://example.com/index。 php,然后像'http://example.com/career.php'那样。 –