刷新< img>定期在jQuery中 [英] Refresh <img> in jQuery periodically

查看:86
本文介绍了刷新< img>定期在jQuery中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似于如何在jQuery ,但不能同时使用.

Similar to How to reload/refresh an element(image) in jQuery but not at the same time.

我有一个网络摄像头,它每2秒保存一次图像,而不是流式传输.使用jQuery(或直接JS),我只想刷新图像元素.

I have a webcam that saves images every 2 seconds rather than streaming. Using jQuery (or straight JS) I want to refresh just the image element.

应该很简单,但是我所有的搜索都显示了按要求刷新.

Should be easy, but all my searches show the refresh on request.

推荐答案

setInterval(function(){
    $("#myimg").attr("src", "/myimg.jpg?"+new Date().getTime());
},2000);

这篇关于刷新< img>定期在jQuery中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆