【发布时间】:2013-12-05 05:51:12
【问题描述】:
我正在我的网站上运行此脚本以显示来自我的网络摄像头的图像。图片5秒后刷新,但是我想让这个功能在30秒后停止,这样就不会浪费太多带宽了。我该怎么做?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Reload iframe for every 5 seconds</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
setInterval(refreshiframe, 5000);
});
function refreshiframe() {
$('#testframe').attr('src', $('#testframe').attr('src'));
}
</script>
</head>
<body>
<div>
<iframe id="testframe" src="http://50.21.204.200/snapshot.jpg" width="640px" height="480px"></iframe>
</div>
</body>
</html>
谢谢
【问题讨论】:
标签: jquery function refresh webcam