Open new Window or frame target

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike R

    #1

    Open new Window or frame target

    Whenever I try to change the html code below to produce the search results
    in a frame or new window it always does it always does it in the same
    window. I assume the problem is it must be specified in the javascript but
    not sure where to start. Can someone show me the correct way in javascript?
    thx

    <html>
    <head>
    <title>Quick Search on Multiple Search Engines</title>
    <script language="JavaS cript" type="text/javascript">
    <!--
    var crawlername = new Array("Google", "Yahoo","Altavi sta (Raging)");
    var crawleraction = new
    Array("http://www.google.com/search?q=","htt p://search.yahoo.co m/bin/search?
    p=","http://www.altavista.c om/sites/search/res_text?q=");

    function populateCrawler s()
    {
    var d=0,startcount= 0,option;
    for (d=0;d<crawlern ame.length;d++)
    {
    option = new Option(crawlern ame[d],crawleraction[d]);
    document.search .crawler.option s[startcount] = option;
    startcount++;
    }
    }

    function initiateSearch( x)
    {
    var url;
    url = x.crawler.optio ns[x.crawler.selec tedIndex].value+x.q.valu e;
    self.location.h ref = url;
    return (false);
    }
    //-->
    </script>

    </head>
    <body onLoad="populat eCrawlers()">
    <h4 align="center"> Quick Search On Various Search Engines</h4>
    <form method="GET" name="search" onSubmit="retur n initiateSearch( this)">
    <table summary="Search " width="50%" align="center">
    <tr>
    <th align="right">S earch:</th>
    <th align="left">
    <input type="text" name="q" size="10"
    maxlength="100" >&nbsp;&nbsp;<i nput type="submit" value="GO">
    </th>
    </tr>
    <tr>
    <th align="right">U se:</th>
    <th align="left">
    <Select name="crawler">
    </Select>
    </th>
    </tr>
    </table>
    </form>
    </body>
    </html>


  • Rob

    #2
    Re: Open new Window or frame target


    "Mike R" <rockhead@nospa m> schreef in bericht
    news:108bm6k1gs 8qm6d@corp.supe rnews.com...[color=blue]
    > Whenever I try to change the html code below to produce the search results
    > in a frame or new window it always does it always does it in the same
    > window. I assume the problem is it must be specified in the javascript[/color]
    but[color=blue]
    > not sure where to start. Can someone show me the correct way in[/color]
    javascript?[color=blue]
    > thx
    >
    > <html>
    > <head>
    > <title>Quick Search on Multiple Search Engines</title>
    > <script language="JavaS cript" type="text/javascript">
    > <!--
    > var crawlername = new Array("Google", "Yahoo","Altavi sta (Raging)");
    > var crawleraction = new
    >[/color]
    Array("http://www.google.com/search?q=","htt p://search.yahoo.co m/bin/search?[color=blue]
    > p=","http://www.altavista.c om/sites/search/res_text?q=");
    >
    > function populateCrawler s()
    > {
    > var d=0,startcount= 0,option;
    > for (d=0;d<crawlern ame.length;d++)
    > {
    > option = new Option(crawlern ame[d],crawleraction[d]);
    > document.search .crawler.option s[startcount] = option;
    > startcount++;
    > }
    > }
    >
    > function initiateSearch( x)
    > {
    > var url;
    > url = x.crawler.optio ns[x.crawler.selec tedIndex].value+x.q.valu e;
    > self.location.h ref = url;
    > return (false);
    > }
    > //-->
    > </script>
    >
    > </head>
    > <body onLoad="populat eCrawlers()">
    > <h4 align="center"> Quick Search On Various Search Engines</h4>
    > <form method="GET" name="search" onSubmit="retur n initiateSearch( this)">
    > <table summary="Search " width="50%" align="center">
    > <tr>
    > <th align="right">S earch:</th>
    > <th align="left">
    > <input type="text" name="q" size="10"
    > maxlength="100" >&nbsp;&nbsp;<i nput type="submit" value="GO">
    > </th>
    > </tr>
    > <tr>
    > <th align="right">U se:</th>
    > <th align="left">
    > <Select name="crawler">
    > </Select>
    > </th>
    > </tr>
    > </table>
    > </form>
    > </body>
    > </html>
    >
    >[/color]


    Use ' window.open(url ); ' , you are replacing the location of the current
    window (hence the objects name 'self');


    HTH Rob



    Comment

    Working...