Debt Consolidation - Find jobs - Debt Consolidation - Debt Consolidation - Wordpress Themes

PDA

View Full Version : Auto Refresh Iframe?


Lipgut
Oct 25th 2008, 10:50 pm
Ok I need a iframe that auto refresh's only the iframe. The iframe leads to a .txt file. The iframe I have now looks something like this:

<iframe name='iframe1' src='/status.txt' frameborder="0" frameborder="0" width='80' height='40'></iframe>

I need that to auto refresh every 5 seconds or so. I would like it to be in java cause that type of coding seems to work in all browsers :P but I know NOTHING about java accept how to put it into the .html . So I would really like your help!

( I can't find a working source anywhere on the internet so you guys are my last hope :D No preasure :P )

imphpguru
Oct 26th 2008, 2:57 am
Hi,
I guess this should work.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function reloadIframe()
{
document.getElementById('iframe1').src='/status.txt';
}
</script>
</head>

<body onload="reloadIframe();">
<iframe name='iframe1' src='/status.txt' frameborder="0" frameborder="0" width='80' height='40' id="iframe1"></iframe>
</body>
</html>


Thanks

imphpguru

elias_sorensen
Oct 27th 2008, 5:13 am
You have to use settimeout to make a loop :)

ads2help
Oct 30th 2008, 5:19 am
every 5 seconds or so

It will be setInterval()

setInterval("YOUR CODE OR REFRESH FUNCTION();",5000)

tdsii
Oct 31st 2009, 3:26 pm
just use:
<meta http-equiv="refresh" content="5" >

this will make the iframe refresh every 5 seconds.

nathan_s
Nov 2nd 2009, 3:09 am
just use:


this will make the iframe refresh every 5 seconds.

doesn't this also refresh the whole page? i'm lost here (