I'm trying to find the best solution to this issue. I need to reload a static jpeg on a website as soon as the image finishes loading (basically I want to keep a constant stream of webcam images). One reason for this is I need it to be quick on a fast connection, but degrade for a user on a slow connection. I've been using the <img onload=""> attribute, but it seems it doesn't work too well in older versions of IE when I am sending XMLHTTP requests. I need this solution to work with IE 6, IE 7, Firefox, Opera, and Safari. Here's my current code:
<img src="cam. jpg" width="320" height="240" name="cam" alt="Webcam Image" onload="Refresh()">
<script language="JavaScript" type="text/javascript">
<!--
var camsrc="cam. jpg";
function Refresh() {
tmp = new Date();
tmp = "?"+tmp. getTime();
document. images["cam"]. src = camsrc+tmp;
}
// -->
</script>
Any help would be great.