Einstein47
Programmer
Hey all,
I have a page where I display the traffic cameras on the highway for my commute. I wanted to see all the cameras at one time. The page works, however the images refresh every 2 min (120 sec).
So I added a count-down timer and when the timer hits zero I refresh the whole page. This works, but isn't very elegant.
I would like to just refresh the traffic camera images, but I don't know if that is even possible. Here is a link to my page and the code so you can see what I currently have. If you can offer any suggestions on how to just refresh the images, I would be very thankful.
Legacy Traffic Cams
Any ideas would be appreciated.
Einstein47 (Starbase47.com)
“PI is like love - simple, natural, irrational, endless, and very important“
I have a page where I display the traffic cameras on the highway for my commute. I wanted to see all the cameras at one time. The page works, however the images refresh every 2 min (120 sec).
So I added a count-down timer and when the timer hits zero I refresh the whole page. This works, but isn't very elegant.
I would like to just refresh the traffic camera images, but I don't know if that is even possible. Here is a link to my page and the code so you can see what I currently have. If you can offer any suggestions on how to just refresh the images, I would be very thankful.
Legacy Traffic Cams
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<title> Legacy Parkway Cameras</title>
<script type="text/javascript">
var timer = 120;
var diff = 2;
function countdown() {
if (timer > 0) {
document.getElementById('counter').innerHTML = timer+" seconds to reload.";
timer -= diff;
setTimeout('countdown()',diff*1000);
}
else {
document.location.reload();
}
}
function startTimer() {
document.getElementById('counter').innerHTML = timer+" seconds to reload.";
timer -= diff;
setTimeout('countdown()',diff*1000);
}
</script>
<style type="text/css">
#main { width: 930px; }
#counter {
text-align: center;
border: solid 1px red;
border-bottom: 0;
background-color: #eeccaa;
}
#container {
height:640px;
overflow: auto;
border: solid 1px red;
}
.cell { text-align: center; float: left; margin: 2px; }
</style>
</head>
<body onload="startTimer()">
<h1>Legacy Parkway Cameras</h1>
<div id="main">
<div id="counter"> </div>
<div id="container">
<div class="cell">200 N., Farmington<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14773.jpeg"[/URL] width= "300" height="225"><br></div>
<div class="cell">250 S., Farmington<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14772.jpeg"[/URL] width="300" height="225"> <br></div>
<div class="cell">Glover Lane, Farmington<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14771.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">1550 S., Farmington<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14770.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">1900 N., Centerville<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14769.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">800 N., Centerville<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14767.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">Parrish Lane, Centerville<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14765.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">Parrish Lane, Centerville<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14766.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">900 W., Centerville<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14764.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">2200 N., West Bountiful<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14763.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">Pages Lane, West Bountiful<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14762.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">1200 N., Woods Cross<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14761.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">400 N., Woods Cross<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14760.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">1900 S., Woods Cross<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14758.jpeg"[/URL] width="300" height="225"> <br></div>
<div class="cell">2425 S., Woods Cross<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14757.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">900 North, North Salt Lake<br><img src=
"[URL unfurl="true"]http://www.utahcommuterlink.com/1_devices/aux14756.jpeg"[/URL] width="300" height="225"><br> </div>
<div class="cell">500 North, North Salt Lake<br><img src=
"[URL unfurl="true"]http://commuterlink.utah.gov/1_devices/aux14755.jpeg"[/URL] width="300" height="225"><br></div>
<div class="cell">Center St., North Salt Lake<br><img src=
"[URL unfurl="true"]http://www.utahcommuterlink.com/1_devices/aux14754.jpeg"[/URL] width="300" height="225"><br></div>
</div>
</div>
</body>
</html>
Any ideas would be appreciated.
Einstein47 (Starbase47.com)
“PI is like love - simple, natural, irrational, endless, and very important“