| | |
Iframe reload with setTimeout
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 4
Reputation:
Solved Threads: 0
Hello,
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:
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?
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:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<head><script type="text/javascript"> function f() { parent.mini.location.reload(); } function r() {setTimeout(f(),2000); } </script> </head>
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?
This is why, you keep on getting those error-->
You forgot to quote it.
And here's my quick example about reloading those iframes' on your page! Hope it helps you... Good day..
function r() { setTimeout(f(),2000); }setTimeout("f()", 2000)And here's my quick example about reloading those iframes' on your page! Hope it helps you... Good day..
html Syntax (Toggle Plain Text)
<html> <head> <title><!--Sample--></title>
javascript Syntax (Toggle Plain Text)
<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 } } </script>
html Syntax (Toggle Plain Text)
</head> <body> <div> <iframe id="frame1" src="yourpage.html"></iframe></div><br /> <input type="button" value="click" onclick="f()" /> </body></html>
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javascript - Picking a quantity displays the price
- Next Thread: Currency usage in calculator form
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxjspservlets array browser bug calendar captchaformproblem cart checkbox child class close codes cookies createrange() cursor date debugger dependent disablefirebug dom dropdown editor element embed engine enter events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl maps masterpage math media menu object onmouseoutdivproblem onreadystatechange parent paypal pdf php position post programming progressbar prototype redirect regex runtime safari scale scriptlets scroll search security session shopping size software sql text textarea toggle unicode variables web windowsxp wysiwyg \n





