I have a problem with something very simple, but because of my 0 knowledge in js, i can't understand what am i doing/thinking wrong. I have one main site, that have 2 small iframes in between everything else. In the second iframe i have a form, when i submit the form, i need the first iframe to be reloaded with delay so it can read the updated info from database.
So, in the second (with the form) iframe i have the code:

<head><script type="text/javascript">
function f() {
function r() {setTimeout(f(),2000);

and on the submit button on the form i have onclick="r()"
This reloads the mini iframe right away and gives Useless setTimeout call (missing quotes around argument?) in FF error console. I tried having some simple examples of setTimeout function, but still didn't get it to work. Tried also with every single syntax i could find online, with no result. Does anybody have any suggestions on what i should/could do?

8 Years
Discussion Span
Last Post by essential

This is why, you keep on getting those error-->

function r() { setTimeout(f(),2000); }

You forgot to quote it.

setTimeout("f()", 2000)

And here's my quick example about reloading those iframes' on your page! Hope it helps you... Good day..

<script type="text/javascript">
function f()
var refresh = document.getElementById('frame1');
/* You can also use -->
   refresh.contentWindow.location.reload( true );
   but not all browser support this function!
   So i wil just perform a simple trick to get things done... Enjoy
   Code is as follows:
  timer = setTimeout('f()', 1000);
if ( timer == 5 ) { clearTimeout( timer ); 
refresh.src = 'yourpage.html#'; //or you can just set this = refresh.src

<iframe id="frame1" src="yourpage.html"></iframe></div><br />
<input type="button" value="click" onclick="f()" />
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.