#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    28
    Rep Power
    0

    Question


    Hi,

    I´m sorry I had to get your attention that way ( ), but I have a very urgent question:

    I created a pop-up window Y from the main window X, and now I want to make it possible to select a link from a pull-down menu in Y - and the page should appear in X.

    Right now I use this form:

    <SCRIPT language="JavaScript">
    <!--
    function fenster()
    {
    opener.location.href = "../domain/"
    }
    //-->
    </SCRIPT>

    and this pull-down:

    <select name=site SIZE=1 onChange="fenster(this.form)">
    <option value="http://www.yoursite.com">Go to....
    <option value="http://www.yahoo.com">Yahoo
    <option value="http://www.metacrawler.com">Metacrawler
    <option value="http://www.altavista.digital.com">Altavista
    <option value="http://www.webcrawler.com">Webcrawler
    <option value="http://www.lycos.com">Lycos
    <option value="http://javascript.internet.com">JavaScript Source
    </select>
    </form>

    but now I only get to ../domain, doesn´t matter what option I select.

    Is it possible to modify this script to use for my purpose (right now it creates a pop-up, but it might help):

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function formHandler(form) {
    var windowprops = "height=500,width=500,location=no,"
    + "scrollbars=no,menubars=no,toolbars=no,resizable=yes";

    var URL = form.site.options[form.site.selectedIndex].value;
    popup = window.open(URL,"MenuPopup",windowprops);
    }
    // End -->
    </script>

    Could you please help me and tell me the code to use?

    Thanks so much,
    steve
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Hatboro, PA
    Posts
    11
    Rep Power
    0
    You aren't using the value passed to fenster(). You are passing "this.form" as an argument to the function fenster() so you need to do something with it:

    <SCRIPT language="JavaScript">
    <!--
    function fenster(arg)
    {
    opener.location.href = arg
    }
    //-->
    </SCRIPT>
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    28
    Rep Power
    0

    thanks, but...


    I want to keep the target url out of the <SCRIPT>...</SCRIPT>, the url should be taken from the <FORM>

    How can I do that?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Location
    UK
    Posts
    527
    Rep Power
    14
    If you call the function with 'this' instead of 'this.form' you will be passing the drop down list instead of the form.

    Then your function becomes:

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function formHandler(dropdown) {
    var windowprops = "height=500,width=500,location=no,"
    + "scrollbars=no,menubars=no,toolbars=no,resizable=yes";

    var URL = dropdown.options[dropdown.selectedIndex].value;
    popup = window.open(URL,"MenuPopup",windowprops);
    }
    // End -->
    </script>

    I think this is what you need.

IMN logo majestic logo threadwatch logo seochat tools logo