Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Oakville
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation iFrame target Parent Javascript guideance needed!

    Hello,

    I am trying to get an iframe to target its parents javascript.

    Parent
    Code:
    <html>
    <head>
    <script>
    function xyz(){
    alert('Way to go')
    }
    </script>
    </head>
    <body>
    <iframe name="myframe" src="myframe.html" height="100" width="100"><iframe>
    </body>
    </html>
    iframe
    Code:
    <html>
    <head>
    
    </head>
    <body>
    <a href="javascript: window.parent.xyz();">Click me</a>
    </body>
    </html>
    But this doesn't work. Any ideas?
    Thanks
    Steve
    Last edited by Steven_Smith; 06-03-2004 at 09:44 PM.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try:

    <a href="javascript&#58;opener.xyz();">Click me</a>

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Quote Originally Posted by Willy Duitt
    Try:

    <a href="javascriptpener.xyz();">Click me</a>
    That will only work if the parent page opens the page in the iframe.

    Steven_Smith, your code should work even though you have an unclosed iframe there.

    <iframe name="myframe" src="myframe.html" height="100" width="100"><iframe>

    Did you encounter any error message?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •