Refresh an iframe from a link on the parent page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Micka1
    New Member
    • Nov 2011
    • 1

    #1

    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:

    Code:
    <html>
    <head>
    <script type="text/javascript">
    
    function Reload () {
    var f = document.getElementById('iframe1');
    f.src = f.src;
    }
    
    </script>
    </head>
    <body>
    <iframe id="iframe1" height="200" width="300"
    src="http://google.com"></iframe>
    <br>
    <input type="button" value="Reload" onclick="Reload();">
    </body>
    </html>
    The link I have now:

    Code:
    <a href="tshirt.html#bottom">1</a>
    Can this be done? Please tell me how. (I write simple HTML and a little scripting.)

    Micka
    Last edited by acoder; Nov 21 '11, 11:30 PM. Reason: Added [code] tags
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    Code:
    <a href="#" onclick="Reload();">Reload</a>
    Last edited by zorgi; Nov 21 '11, 11:40 PM. Reason: added code tags

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Something like this:
      Code:
      <a href="tshirt.html#bottom" onclick="Reload(); return false;">1</a>
      Edit: posted a few seconds after Zorgi...

      Comment

      • DaveRook
        New Member
        • Jul 2007
        • 147

        #4
        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?

        Comment

        Working...