Download AJAXCam Now

For the image you want to reload, be sure to add a name="campic" within the <img> tag and include the onLoad event in the <body> tag:

<body onLoad="holdUp()">
<p>
<img src="http://www.98online.com/webcam/studio1_0000000001.jpg" width="320" height="240" name="campic" />
</p>
<p></p>
</body>

Then copy the code below and include it in the <head> section of your webpage. Be sure to set refreshFreq=xx to the number of seconds between refreshes that you are looking for.

<script type="text/javascript">
<!--
//
//AJAXCam v0.8b (c) 2005 Douglas Turecek http://www.ajaxcam.com
//
function holdUp()
{
//
// This function is first called either by an onLoad event in the <body> tag
// or some other event, like onClick.
//
// Set the value of refreshFreq to how often (in seconds)
// you want the picture to refresh
//
refreshFreq=10;
//
//after the refresh time elapses, go and update the picture
//
setTimeout("freshPic()", refreshFreq*1000);
}

function freshPic()
{
//
// Get the source value for the picture
// e.g. http://www.mysite.com/doug.jpg and
//
var currentPath=document.campic.src;
//
// Declare a new array to put the trimmed part of the source
// value in
//
var trimmedPath=new Array();
//
// Take everything before a question mark in the source value
// and put it in the array we created e.g. doug.jpg?0.32234 becomes
// doug.jpg (with the 0.32234 going into the second array spot
//
trimmedPath=currentPath.split("?");
//
// Take the source value and tack a qustion mark followed by a random number
// This makes the browser treat it as a new image and not use the cached copy
//
document.campic.src = trimmedPath[0] + "?" + Math.random();
//
// Go back and wait again.
holdUp();
}

// -->
</script>

SPECIAL OFFER! Save 50%* on New Web Hosting Plans

Home

Why AJAXCam

Download Now

Example Page

Webcams

Links

Digg It