Results 1 to 2 of 2
  1. #1

    Open these links in parent window?

    Hi have a script that is a dropdown box that goes to all these links on my website. I want to include it on the pages listed using iframe, but when i do that, it opens it in the same frame. How do i modify this code so that it opens in the parent frame?

    Code:
    <head>
    <style type="text/css">
    <!--
    .nochoice {color: blue;}
    .choice {color: black; }
    -->
    </style>
    <script type="text/javascript">
    <!--
    function redirect(pulldown)
    {
    newlocation = pulldown[pulldown.selectedIndex].value;
    if (newlocation != "")
    self.location = newlocation;
    }
    function resetIfBlank(pulldown)
    {
    possiblenewlocation = pulldown[pulldown.selectedIndex].value;
    if (possiblenewlocation == "")
    pulldown.selectedIndex = 0; // reset to start since no movement
    }
    //-->
    </script>
    </head>
    <body>
    <form name="navForm" id="navForm" action="redirector.cgi" onsubmit="return false">
    <label>Jicola.com Sites:
    <select name="menu" id="menu" onchange="resetIfBlank(this)">
    <option value="http://www.jicola.com" class="choice" selected" selected>Jicola.com</option>
    <option value="http://www.classifieds.jicola.com" class="choice" selected" selected>Classifieds - buy and sell</option>
    </select>
    </label>
    <input type="submit" value="Go" onclick="redirect(document.navForm.menu); return
    false;" />&nbsp;
    Note* I took out most of the links. I left a couple in for an exameple. So basically, i want the links to open in the parent frame.

  2. #2
    Join Date
    Aug 2004
    Location
    Shanghai
    Posts
    1,449
    Hi,

    Just use:

    parent.top.location = url;

    and you'll get what you wanted. Note that I didn't read your code, but I know what I just past worked for me (in both IE and FF).

    Thomas
    GPLHost:>_ open source hosting worldwide (I'm founder, CEO & official Debian Developer)
    Servers & our leading control panel and our Xen VPS hosting, which are already included in Debian and Ubuntu
    Available in: Kuala Lumpur, Singapore, Sydney, Seattle, Atlanta, Paris, London, Barcelona, Zurich, Israel

Posting Permissions

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