<html>
<head>
</head>
<body>
<div>
<object width="100%"
height="100%"
id="liveTV_api"
name="liveTV_api"
data="http://www.extratv.gr/media/imgs/flowplayer-3.2.15.swf" type="application/x-shockwave-flash">
<param name="allowfullscreen"
value="true">
<param name="allowscriptaccess"
value="always">
<param name="quality"
value="high">
<param name="bgcolor"
value="#000000">
<param name="flashvars"
value="config={"clip":{"url":"mpegts_256.stream","provider":"rtmp","live":true,"scaling":"fit"},"plugins":{"rtmp":{"url":"http://www.extratv.gr/media/imgs/flowplayer.rtmp-3.2.11.swf","netConnectionUrl":"rtmp://213.16.167.186:1935/live","subscribe":true}},"playerId":"liveTV","playlist":[{"url":"mpegts_256.stream","provider":"rtmp","live":true,"scaling":"fit"}]}">
</object>
<img id="adtv" src="img.png">
</div>
<?php
set_time_limit(0);
$x=1;
while(x==1) {
$now = date('G',time());
$start = 12;
$end = 13;
if($now >= $start && $now <= $end):
echo '<script type="text/javascript">document.getElementById("adtv").style.display="none"; </script>';
echo '<script type="text/javascript">document.getElementById("liveTV_api").style.display="block"; document.getElementById("adtv").style.display="none";</script>';
else:
echo '<script type="text/javascript">document.getElementById("adtv").style.display="block"; document.getElementById("liveTV_api").style.display="none";</script>';
endif;
sleep(3600);
}
?>
</body>
</html>
好的我需要一个程序,在一天内1小时将显示1小时长度的视频,然后在接下来的23小时内显示图像。 视频工作正常,但在视频div处于活动状态时,图像也会显示而不是隐藏。似乎js根本不起作用,我不知道为什么。
答案 0 :(得分:0)
仅使用Javascript,我还没有测试过:
<html>
<head>
</head>
<body>
<div>
<object width="100%" height="100%" id="liveTV_api" name="liveTV_api"
data="http://www.extratv.gr/media/imgs/flowplayer-3.2.15.swf" type="application/x-shockwave-flash"><param
name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="quality"
value="high"><param name="bgcolor" value="#000000"><param name="flashvars" value="config={"clip":{"url":"mpegts_256.stream","provider":"rtmp","live":true,"scaling":"fit"},"plugins":{"rtmp":{"url":"http://www.extratv.gr/media/imgs/flowplayer.rtmp-3.2.11.swf","netConnectionUrl":"rtmp://213.16.167.186:1935/live","subscribe":true}},"playerId":"liveTV","playlist":[{"url":"mpegts_256.stream","provider":"rtmp","live":true,"scaling":"fit"}]}"></object>
<img id="adtv" src="img.png">
</div>
<script type="text/javascript">
function update() {
var now = (new Date()).getHours(),
start = 12,
end = 13;
if(now >= start && now <= end) {
document.getElementById("adtv").style.display="none";
document.getElementById("liveTV_api").style.display="block";
}
else {
document.getElementById("adtv").style.display="block";
document.getElementById("liveTV_api").style.display="none";
}
}
// repeat interval in milliseconds
window.setInterval(update, 3600000);
update();
</script>
</body>
</html>