Solved

Javascript setInterval on a frameset

Posted on 2008-10-17
2
496 Views
Last Modified: 2012-06-27
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) {
        window.frames['forum'].src=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?
Thanks.
<!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>
<title>Testing Frame reload</title>
<script type="text/javascript">
// <![CDATA[
window.setInterval("reload('http://www.google.com')", 5000);
function reload(url) {
        window.frames['forum'].src=url;
}
 
// ]]>
</script>
</head>
 
<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" />
  </FRAMESET>
  <frame frameborder="0" scrolling="no" noresize  marginwidth="7" marginheight="0" src="session.php" name="session" />
  <NOFRAMES></NOFRAMES>
</FRAMESET>
</html>

Open in new window

0
Comment
Question by:dban00b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 500 total points
ID: 22747144
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.
0
 
LVL 1

Author Comment

by:dban00b
ID: 22749292
Yup the problem was I can't do this from the frameset page, it has to be done from within the frame.
Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question