Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

Javascript setInterval on a frameset

I have a frameset page that I would like to run the javascript function setInterval.

window.setInterval("reload('http://www.google.com')", 5000);
function reload(url) {

But It doesn't work as I expect, nothing happens.  I've attached the whole page in case my problem is not limited to just the javascript, but somewhere else in the html.
What did I miss or do wrong?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Testing Frame reload</title>
<script type="text/javascript">
// <![CDATA[
window.setInterval("reload('http://www.google.com')", 5000);
function reload(url) {
// ]]>
<FRAMESET cols="*, 165">
  <FRAMESET rows="120, *">
      <FRAME frameborder="0" marginwidth="5" marginheight="5" border="0" src="header.html" name="main" />
      <FRAME frameborder="0" marginwidth="5" marginheight="5" border="0" src="forum.php" name="forum" />
  <frame frameborder="0" scrolling="no" noresize  marginwidth="7" marginheight="0" src="session.php" name="session" />

Open in new window

1 Solution
Since the source page is not refreshing, the frame will not refresh either -- i.e. nothing happens.  

In the frame page, simply put this in the HEAD of the document --

<meta http-equiv="Refresh" content="5000; url=myFramesetPage.html">

That will reload the frame page in the frame every 5000 seconds.
dban00bAuthor Commented:
Yup the problem was I can't do this from the frameset page, it has to be done from within the frame.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now