Results 1 to 8 of 8

Thread: Drop Down Box within iframe

  1. #1
    Join Date
    Jul 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question Drop Down Box within iframe

    I have a drop down box within an iframe. I would like it so that when the drop down box is used the entire page loads outside the borders of the iframe and the iframe disappears. I've been trying to change the below code but no luck whatsoever?! Is there anyone clever enough and kind enough out there to amend my below code, it would be a great help!!

    <form name="jumpy">
    <p><select style="width:350px" name="example" size="1" onChange="gone()">
    <option value="">Select</option>
    <option value=""></option>
    <option value="http://www.google.com">Google</option>
    <option value="http://www.yahoo.com">Yahoo</option>
    <option value="http://www.altavista.com">Alta Vista</option>
    </select>
    <script language="javascript">
    <!--

    /*Jumpy combo box credit:
    JavaScript Kit (www.javascriptkit.com)
    Over 200+ free JavaScripts here!
    */

    function gone()
    {
    location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    }
    //-->
    </script>
    </p>
    </form>

  2. #2
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default Ez

    Simple. Here is some code for the outer page:

    Code:
    <html>
    <head>
    <title>
    </title>
    <script language="JavaScript">
    setInterval("check_for_change()", 100);
    
    function check_for_change()
    {
    if(iframe.document.jumpy.example.selectedIndex==2)
    {
    window.location="http://www.google.com";
    }
    if(iframe.document.jumpy.example.selectedIndex==3)
    {
    window.location="http://www.yahoo.com";
    }
    if(iframe.document.jumpy.example.selectedIndex==4)
    {
    window.location="http://www.altavista.com";
    }
    }
    </script>
    </head>
    <body>
    <iframe src="your_src.html" name="ifram" id="ifram" width="500" >SORRY! IFRAMES DON'T WORK IN YOUR INTERNET BROWSER!</iframe>
    </body>
    </html>
    That should do it.

    -magicyte

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

    mstolton (07-09-2008)

  4. #3
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    It should, but rather than add all that code, try changing:

    Code:
    location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    to:

    Code:
    top.location=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
    Alternatively, using parent in place of top would work, but only if you aren't nesting frames inside of each other.
    Verzeihung!

  5. The Following User Says Thank You to Minos For This Useful Post:

    mstolton (07-09-2008)

  6. #4
    Join Date
    Jul 2008
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks for this! they both work. Cheers!

  7. #5
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Hey, Minos, I make a living off of my OWN code. I don't change other people's code.

    -magicyte

  8. #6
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    Quote Originally Posted by magicyte View Post
    Hey, Minos, I make a living off of my OWN code. I don't change other people's code.
    Quote Originally Posted by mstolton View Post
    Is there anyone clever enough and kind enough out there to amend my below code, it would be a great help!!
    Make your living however you want, I did what the OP asked. There's no need to flame someone who has a more succinct, and still correct, answer.
    Verzeihung!

  9. #7
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by Minos View Post
    Make your living however you want, I did what the OP asked. There's no need to flame someone who has a more succinct, and still correct, answer.
    Sorry for my ignorant action...

    -magicyte

    P.S.

  10. #8
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by magicyte View Post
    Hey, Minos, I make a living off of my OWN code. I don't change other people's code.

    -magicyte
    Quite stupid of me.

    -magicyte

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
  •