Click to See Complete Forum and Search --> : Toggleable Auto Refresh?


functor
December 22nd, 2008, 01:13 PM
Hello Everyone,

I have an asp page that has a menu across the top and then an iframe below to another page. What I'm trying to do create a button in the menu that turns auto refresh on and off. All I can find is how to enable auto refresh. Anyone know how I can accomplish this?

Thanks!

functor
December 23rd, 2008, 10:39 AM
I've got it partially working using javascript. I've created a button to turn on auto refresh, but when the page refreshes the first time it turns auto refresh off again. Here is what I have so far:

var tmrRefreshInts = setInterval("fnRefreshInts()", 5000);

function fnRefreshInts()
{
var imgSrc = document.getElementById("imOnline").src;

try
{
if(imgSrc.indexOf("divIconOk.gif") > 0)
{
fnRefresh();
}
}
catch(e) {}
}

function fnToogleChkOnline()
{
var imgSrc = document.getElementById("imOnline").src;
if ( imgSrc.indexOf("divIconError.gif") > 0)
{
document.getElementById("imOnline").src = "../global/images/divIconOk.gif";
}
else
{
document.getElementById("imOnline").src = "../global/images/divIconError.gif";
}

}


...

<td><input type=button class="global_button_label_new" ID="inOnline" onclick="fnToogleChkOnline();" runat="server" value="<% $Resources:Online%>"></td>
<td><img id="imOnline" src="../global/images/divIconError.gif"></img></td>

dannystommen
December 23rd, 2008, 11:20 AM
Why not use an timer? When the button is clicked you could enable/disable the timer.