EDIT:
Thanks Akshat and Jefferey for your help and advice. I'm going to re-ask my question in very simple terms:
How can I make my webpage smoothly re-position an image when it's coordinates change. An application writes the cordinates to a file on the server every minute or so. I say smoothly because I don't want user intervention or a forced page refresh (META HTTP-EQUIV=REFRESH CONTENT=300), that would be easy but not be a good user experience.
I hope this makes sense. Thank you again.
I have a simple webpage with an image - a map - which changes every minute or so. The map dynamically updates every 30 seconds as follows:
<script language="JavaScript">
<!--
function refreshMap1() {
if (!document.images) return;
document.images['map1'].src = 'map1.jpg?' + Math.random();
setTimeout('refreshMap1()',30000);
}
//--></script>
Then:
<body onload=" setTimeout('refreshMap1()',30000)">
<img src="map1.jpg" name="map1">
This works fine.
I overlay an animated gif on the map by loading a StyleSheet containing absolute positioning as follows:
<link rel="stylesheet" type="text/css" href="position.css" />
Then:
<img src="animation.gif" class="pos1" id="a1">
The css file (position.css) simply contains:
.pos1 { position: absolute; left: 300px; top: 400px; }
This works fine also, but.... The css file will change every minute or so the same as the map to reflect a new position for the gif. I want to dynamically change the position of the animated gif by forcing an update of the css every 30 seconds in a similar way as the map. I haven't been able to find a method to force a dynamic timed update of a css file.
Any ideas?
TIA.