468,514 Members | 1,595 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Refresh an iframe from a link on the parent page

How do I refresh an iframe from a link on the parent page?

This button (posted by Marss on this forum) does exactly what I need. But I want this to happen from a link, not a button. The button Marss wrote:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  5. function Reload () {
  6. var f = document.getElementById('iframe1');
  7. f.src = f.src;
  8. }
  10. </script>
  11. </head>
  12. <body>
  13. <iframe id="iframe1" height="200" width="300"
  14. src="http://google.com"></iframe>
  15. <br>
  16. <input type="button" value="Reload" onclick="Reload();">
  17. </body>
  18. </html>
The link I have now:

Expand|Select|Wrap|Line Numbers
  1. <a href="tshirt.html#bottom">1</a>
Can this be done? Please tell me how. (I write simple HTML and a little scripting.)

Nov 19 '11 #1
3 4287
431 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. <a href="#" onclick="Reload();">Reload</a>
Nov 21 '11 #2
16,027 Expert Mod 8TB
Something like this:
Expand|Select|Wrap|Line Numbers
  1. <a href="tshirt.html#bottom" onclick="Reload(); return false;">1</a>
Edit: posted a few seconds after Zorgi...
Nov 21 '11 #3
147 100+
the input type button doesnt have to display as a button though? You can easily use some CSS to make it appear as normal text. would that work?
Nov 25 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Luboą ©lapák | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.