Updating server side data and displayed on a client (java/javascript)

P

Paul Lee

Dear all,
This is related to a posting that I asked a few days ago, but it
subtly different.

We are trying to develop a webpage that displays an image from a
server side webcam every couple of second. My friend has come up
with some javascript code that seems to work, but what we would like
is the server side time that the image was taken, and we are thinking
about javabeans. Is there a way to mix java/javabeans and javascript to do this?

For your information, here is the javascript code:

<script LANGUAGE="JavaScript1.2">
// <!--
// Set the BaseURL to the url of your camera
// Example: var BaseURL = "http://172.21.1.122/";
var delay = 20000;

var BaseURL = "http://**.**.**.**/";

var Camera = "";

var ImageResolution = "704x576";
var DisplayWidth = "704";
var DisplayHeight = "576";

// No changes required below this point
var File = "axis-cgi/jpg/image.cgi?resolution=" + ImageResolution;

theDate = new Date();

var output = "<IMG SRC=\"";
output += BaseURL;
output += File;
output += "&dummy=";
output += theDate.getTime().toString(10);
// The above dummy cgi-parameter enforce a bypass of the browser image cache.
output += "\" HEIGHT=\"";
output += DisplayHeight;
output += "\" WIDTH=\"";
output += DisplayWidth;
output += "\" ALT=\"Webcam Display\"";
output += " NAME=\"WEBPIC\">";

document.write(output);

function update(){
var newpic;

theDate = new Date();

newpic = BaseURL;
newpic += File;
newpic += "&dummy=";
newpic += theDate.getTime().toString(10);

document.images["WEBPIC"].src = newpic;
setTimeout("update()", delay);
}


update();


// -->

</script>


Thanks for your help

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top