[Javascript] writing/reading the same file at the same time

Flavio Gomes flavio at economisa.com.br
Tue May 25 08:19:31 CDT 2004


  Does the perl script takes a long time to write the image?

   You could try to do something like this, the perl script could write 
in a file named "image.jpg" but the JScript would access only 
"image_ready.jpg" that'd be a copy of the image ready to be used.

 Hope to Help,

---
Flavio Gomes
flavio at economisa.com.br



Günther Mittermayer wrote:

>Hi there, 
>
>I have an application, where the JavaScript refreshes an Image contained in a HTML page.
>
>Since this image is continuously generated by a Perl script, I get a random blinking of the image, that I am assuming to be due to the times when both (the Javascript and the Perl script) try to access the image at the same time.
>
>anyone got an Idea on how to solve that?  I tried "preloading" the image, but nope.. doesn't work.
>
>It is not very critical if I miss some refreshes, that is, if the Javascript tries reading the file when it is in use, it is ok not to do anything, and wait for the next loop....  
>does JavaScript handle exceptions?? how does that work, with try/catches just like in Java?
>
>any help/ comments are welcome,
>Günther.
>
>here is some code:
>
><html>
><head>
>
><meta http-equiv="cache-control" content="no-cache">
><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
><meta name="description" content="Fireworks Splice HTML">
>
><script type="text/javascript">
>function refresh_image()
>{
>
><!-- Preloads the Image to a temporary variable to avoid blinking - Nice try.. but not working-->
>img_tmp = new Image();
>img_tmp.src = "theimage.png";
>
><!-- Refreshes the image -->
>var img = document.getElementById('imageID');
>img.src = img_tmp.src;
>setTimeout('refresh_image()',600)
>};
>
></script>
></head>
><body onLoad="setTimeout('refresh_image()',600)">
><form method='POST' action='/cgi-bin/elem_props.cgi' target='elem_props'>
>	<center><input type='image' name='image1' id='imageID' src='theimage.png'></center>
></form>
></body>
></html>
>
>_______________________________________________________________________
>Moechten Sie Ihre SMS noch ausdrucksstaerker und emotionaler gestalten?
>Fuegen Sie einfach ein Bild hinzu! http://freemail.web.de/?mc=021194
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>



More information about the Javascript mailing list