For Programmers: Free Programming Magazines  


Home > Archive > ASP > October 2004 > Dynamic updates









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Dynamic updates
Dev880

2004-10-27, 3:55 pm

I need to know if I should use asp.net or Java for this. I would like to use
asp in general.

I need to have a function check to see if a variable is true or false and
update an icon. But I want it to either check when updated or every 3
seconds. I suppose it has to be somewhat client side scripting but is there a
way around this. As of now I use IFrames whith a refresh of 10 seconds, any
less will cause it to timeout. I kind of want it real-time or very near. It's
kind of like a status page for information in a database. Any suggestions?

Thanks
Ray Costanzo [MVP]

2004-10-27, 3:55 pm

<html><body onload="checkImage();">
<script type="text/javascript">
function checkImage() {
document.images['x'].src='image.asp';
window.setTimeout('checkImage()',300);
}
</script>
<img name="x" src="">
</body>
</html>


Where image.asp looks like:

<%
If Second(Time) Mod 2 = 0 Then
sImage = "even.gif"
Else
sImage = "odd.gif"
End If
Response.Redirect sImage
%>

Ray at work

"Dev880" <Dev880@discussions.microsoft.com> wrote in message
news:D5E63A94-3D3F-4888-B946-448830187A24@microsoft.com...
>I need to know if I should use asp.net or Java for this. I would like to
>use
> asp in general.
>
> I need to have a function check to see if a variable is true or false and
> update an icon. But I want it to either check when updated or every 3
> seconds. I suppose it has to be somewhat client side scripting but is
> there a
> way around this. As of now I use IFrames whith a refresh of 10 seconds,
> any
> less will cause it to timeout. I kind of want it real-time or very near.
> It's
> kind of like a status page for information in a database. Any suggestions?
>
> Thanks



Ray Costanzo [MVP]

2004-10-27, 3:55 pm

Whoops. Make that 3000, not 300 in setTimeout. :]

Ray at work

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:uo9JymEvEHA.2876@TK2MSFTNGP12.phx.gbl...
> <html><body onload="checkImage();">
> <script type="text/javascript">
> function checkImage() {
> document.images['x'].src='image.asp';
> window.setTimeout('checkImage()',300);
> }
> </script>
> <img name="x" src="">
> </body>
> </html>
>
>
> Where image.asp looks like:
>
> <%
> If Second(Time) Mod 2 = 0 Then
> sImage = "even.gif"
> Else
> sImage = "odd.gif"
> End If
> Response.Redirect sImage
> %>
>
> Ray at work
>
> "Dev880" <Dev880@discussions.microsoft.com> wrote in message
> news:D5E63A94-3D3F-4888-B946-448830187A24@microsoft.com...
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com