469,951 Members | 2,355 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

Iframe Refresh

I am using a shoutbox cgi and the messages are written to a file called
tagbox.html using a form.

After so many messages the file is blanked and new lines are written.

I can cause a refesh say every 20 seconds by embedding a meta tag in the
tagbox.html thus:

<META HTTP-EQUIV="refresh" content="20">

However this gets blanked out along with all the other message lines.

tagbox.html is called into an iframe via a cgi script.

I need a form of javascript to embed into the cgi script such that
tagbox.html will be refreshed.

Any ideas? Thanks.
Jul 20 '05 #1
3 7189
Nigel Wroe wrote:
I am using a shoutbox cgi and the messages are written to a file called
tagbox.html using a form.

After so many messages the file is blanked and new lines are written.

I can cause a refesh say every 20 seconds by embedding a meta tag in the
tagbox.html thus:

<META HTTP-EQUIV="refresh" content="20">

However this gets blanked out along with all the other message lines.

tagbox.html is called into an iframe via a cgi script.

I need a form of javascript to embed into the cgi script such that
tagbox.html will be refreshed.

Any ideas? Thanks.


In your main page:

<script type="text/javascript">

var milliSecondsToWait = 20000;

function reloadIFrame(){
document.frames['iFrameName'].location.href =
"tagbox.html?" + (new Date().getTime());
myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
}
var myVar = setTimeout("reloadIFrame()",milliSecondsToWait);

</script>

<iframe id="iFrameName" src="tagbox.html"></iframe>

The ?(new Date().getTime()) is to make the URL unique and keep the file
from being gotten from the cache.

Enjoy

--
Randy

Jul 20 '05 #2
Thanks,

That works a treat!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Randy Webb wrote:
In your main page:

<script type="text/javascript">
var milliSecondsToWait = 20000;
function reloadIFrame(){
document.frames['iFrameName'].location.href =
"tagbox.html?" + (new Date().getTime());
myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
}
var myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
</script>

<iframe id="iFrameName" src="tagbox.html"></iframe>

Randy,

I'm using your code to refresh a page in an iframe and jump to an anchor
placed at the bottom of the iframe page.

<html>

<head>
<script type="text/javascript">
var milliSecondsToWait = 5000;
function reloadIFrame(){
//document.frames['iFrame1'].location.href ="2.html?" + (new
Date().getTime());
window.frames['iframe1'].location = "2.html?" + (new Date().getTime());
window.frames['iframe1'].location.hash="#bottom"
myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
}
var myVar = setTimeout("reloadIFrame()",milliSecondsToWait);
</script>
</head>

<body onload='reloadIFrame()'>
test
<p>&nbsp;
<iframe height="450" width="600" src="2.html#bottom" name="iframe1"
scrolling="yes">This browser does not support...</iframe>
<p>&nbsp;
test
<form method="POST" action="--WEBBOT-SELF--">
<p>
<input type="text" name="T1" size="20">
<input type="button" value="Button" name="B3">
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
It works, but it also scrolls the page with the inserted iframe to the
bottom! Any suggestions on how I can jump to the bottom of the iframe only?

Nice code, thanks,
Mike

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Conax | last post: by
11 posts views Thread by HolaGoogle | last post: by
2 posts views Thread by Jeronimo Bertran | last post: by
2 posts views Thread by J-T | last post: by
reply views Thread by Abhishek Srivastava | last post: by
reply views Thread by spolsky | last post: by
1 post views Thread by spolsky | last post: by
3 posts views Thread by PCgeek | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.