【问题标题】:Change iFrame Content based on Time根据时间更改 iFrame 内容
【发布时间】:2017-10-04 01:58:22
【问题描述】:
我希望嵌入的 livestream.com 链接随时间而变化,但在网站上的一个容器中完成,而不是整个页面。
因此,对于 6AM-8AM,嵌入的内容会加载“livestream.com/video1”
但在上午 8 点到下午 3 点,嵌入的内容会加载“livestream.com/video2”
如果没有完全重定向,这可能吗?我该怎么做?
【问题讨论】:
标签:
javascript
html
time
live-streaming
【解决方案1】:
你会明白的
$(document).ready(function(){
$('a')[0].click();
});
var randompage = ['https://www.spirithoods.com/pages/dummypage','https://lifehacker.com','http://www.lipsum.com']
setInterval(function() {
rndm=Math.floor(Math.random() * 3) + 0
$('a').attr('href',randompage[rndm]);
$('a')[0].click();
}, 5000);
.iframes{
width:100%;
height:400px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href='https://www.spirithoods.com/pages/dummy-page' target='iframename' class='clickit'>hello</a>
<iframe name='iframename' class='iframes'>
</iframe>