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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open in new window from menu in frame ?

    Hi,

    I am just looking at what can be done with frames.

    I have a Drop down menu w/ description - (http://www.dynamicdrive.com/dynamici...bodescribe.htm) In a small frame in the top left of my page.

    How do I get the result of my menu selection to open in a new window ? I have made changes to the Default target Frame settings,"New Window" and "Whole Page" with no luck.

    I can make links open in a new window by adding target="_blank" to :

    <a target="_blank" href="../bench.htm">Video bench Marks</a>

    How do I get the same result with a menu ?

    Greatful for any help,
    -R-

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Try changing this:

    <input type="button" value="Go"
    onClick="location=document.a294.a969.options[document.a294.a969.selectedIndex].value">

    to this:

    <input type="button" value="Go"
    onClick="window.open(document.a294.a969.options[document.a294.a969.selectedIndex].value)">

    and to learn how to customise that new pop-up window check out this tutorial:

    http://www.javascriptkit.com/javatutors/window1.shtml

  • #3
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great ! Works like a charm ! Thank you very much !

    There is half my problem solved !

    I have a different kind of search in the top right. I can't see how to do the same thing with this one:

    <SCRIPT>
    <!-- hide this script from non-JavaScript browsers

    var MAX_ENGINES = 75;
    var SNARK_STRING = "hunting+the+snark";

    function MakeArray(n) {
    for (var i = 1; i <= n; i++) {
    this[i] = 0;
    }
    this.maxlen = n;
    this.len = 0;
    return this;
    }

    var engs = new MakeArray(MAX_ENGINES);

    function find_substring(needle, haystack) {
    var i, needlen = needle.length, haylen = haystack.length;
    for (i=0; i<=haylen-needlen; i++) {
    if (needle == haystack.substring(i,i+needlen))
    return i;
    }
    return false;
    }

    function Engine(name, opts, home, search) {
    var snark = find_substring(SNARK_STRING, search);
    this.name = name;
    this.opts = opts;
    this.home = home;
    this.pre_snark = search.substring(0,snark);
    this.post_snark= search.substring(snark+SNARK_STRING.length, search.length);
    }

    function Add(name, opts, home, search) {
    engs.len++;
    if (engs.len <= engs.maxlen) {
    engs[engs.len] = new Engine(name, opts, home, search)
    }
    else {
    alert("Better increase MAX_ENGINES: " + engs.len + ">" + engs.maxlen)
    }
    }


    // ADD YOUR OWN SEARCH ENGINES BELOW. (See http://www.cs.cmu.edu/~jab/snark/ )

    Add("Google", "",
    "http://www.google.com",
    "http://www.google.com/search?q=hunting+the+snark&btnG=Google+Search");

    Add("Alltheweb", "",
    "http://www.AllTheWeb.com",
    "http://www.alltheweb.com/search?cat=web&lang=english&query=hunting+the+snark");

    // ADD YOUR OWN SEARCH ENGINES ABOVE. (See http://www.cs.cmu.edu/~jab/snark/ )


    function HandleForm(form) {
    form.submit(); // This fixes a mysterious Netscape bug. Without this line,
    // you can't use <enter> to start the search the first time.
    var i, oldq=form.query.value, newq="";
    for (i=0; i<oldq.length; i++) { // compress [ ]+ into \+
    var thischar = oldq.charAt(i);
    if (thischar != ' ')
    newq += thischar;
    else if (lastchar != ' ')
    newq += '+';
    lastchar = thischar;
    }
    var eng = engs[1+form.service.selectedIndex];
    location.href = newq ? eng.pre_snark + newq + eng.post_snark : eng.home;
    }


    function DisplayForm() {
    document.writeln('<CENTER><FORM OnSubmit="HandleForm(this); return false">');
    document.writeln('<SELECT name="service">');
    for (i=1; i <= engs.len; i++) {
    document.writeln("<OPTION " + engs[i].opts + "> " + engs[i].name);
    }
    document.writeln('</SELECT> <INPUT size=20 name="query">');
    document.writeln('<input type=submit value=" Submit">');
    document.writeln('<input type=reset value=" Reset">');
    document.writeln('</FORM> </CENTER>');
    }


    DisplayForm();


    // done hiding from old browsers -->
    </SCRIPT> <!-- END JavaScript Search Code ---->

    Maybe something in this line ?

    }
    var eng = engs[1+form.service.selectedIndex];
    locaton.href = newq eng.pre_snark + newq + eng.post_snark : eng.home;
    }

    I don't know.....still learning. If you can fix this for me as well, I would be most greatful indeed !

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Weel just try it and see what happens, change this:

    location.href = newq ? eng.pre_snark + newq + eng.post_snark : eng.home;


    to this:

    window.open(newq ? eng.pre_snark + newq + eng.post_snark : eng.home);


  •  

    Posting Permissions

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