Results 1 to 6 of 6

Thread: simple iframe help

  1. #1
    Join Date
    Aug 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool simple iframe help

    how would you get this code to work from an iframe to the parent page?

    HTML Code:
    <img src="Picture.png" onclick="My Code"/>
    I'm Looking to get the 'onclick="My Code"' to apply for the parent page

    sorry, i really hope this is specific enough, thanx

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I believe you can use this:
    window.parent.myfunction();


    Note: iframes bring up security issues, but if both pages are from the same domain it should help.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    Clayf700 (02-06-2011)

  4. #3
    Join Date
    Aug 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    sweet, ill give it a try

  5. #4
    Join Date
    Aug 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    hmmm... actually i used this in the iframe code and it dosn't seem to be working:

    HTML Code:
    <img src="Picture.png" onclick="window.parent.Appear('VideoFolder');"/>
    know what's going on?

  6. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I'm not sure. I'd suggest starting simple, with a dummy function like makealert() in which there is only the code alert('Hello World');. Once that works, see if you can combine it.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #6
    Join Date
    Aug 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    alright, i'v already tried that and i don't think i told you enough on the first run. what this script does is simply make things disappear and appear by id, so i have dialogs by specific id's that disappear/appear by a special button located in an iframe, so here is the script making them disappear and appear:

    HTML Code:
      function Appear(itemID){ 
          // Toggle visibility between hidden and visible 
          if ((document.getElementById(itemID).style.visibility == 'hidden')) 
          { 
            document.getElementById(itemID).style.visibility = 'visible'; 
          } else { 
            document.getElementById(itemID).style.visibility = 'hidden'; 
          } 
      }
    so i want each button to be able to make a different object appear/disappear. and if i made a different section of the script for each dialog it would be massive, so i'm trying to find an easy way around. got any ideas?

Bookmarks

Posting Permissions

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