469,579 Members | 1,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

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="JavaScript" type="text/javascript">
<!--
var crawlername = new Array("Google","Yahoo","Altavista (Raging)");
var crawleraction = new
Array("http://www.google.com/search?q=","http://search.yahoo.com/bin/search?
p=","http://www.altavista.com/sites/search/res_text?q=");

function populateCrawlers()
{
var d=0,startcount=0,option;
for (d=0;d<crawlername.length;d++)
{
option = new Option(crawlername[d],crawleraction[d]);
document.search.crawler.options[startcount] = option;
startcount++;
}
}

function initiateSearch(x)
{
var url;
url = x.crawler.options[x.crawler.selectedIndex].value+x.q.value;
self.location.href = url;
return (false);
}
//-->
</script>

</head>
<body onLoad="populateCrawlers()">
<h4 align="center">Quick Search On Various Search Engines</h4>
<form method="GET" name="search" onSubmit="return initiateSearch(this)">
<table summary="Search" width="50%" align="center">
<tr>
<th align="right">Search:</th>
<th align="left">
<input type="text" name="q" size="10"
maxlength="100">&nbsp;&nbsp;<input type="submit" value="GO">
</th>
</tr>
<tr>
<th align="right">Use:</th>
<th align="left">
<Select name="crawler">
</Select>
</th>
</tr>
</table>
</form>
</body>
</html>
Jul 23 '05 #1
1 5391
Rob

"Mike R" <rockhead@nospam> schreef in bericht
news:10*************@corp.supernews.com...
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="JavaScript" type="text/javascript">
<!--
var crawlername = new Array("Google","Yahoo","Altavista (Raging)");
var crawleraction = new
Array("http://www.google.com/search?q=","http://search.yahoo.com/bin/search? p=","http://www.altavista.com/sites/search/res_text?q=");

function populateCrawlers()
{
var d=0,startcount=0,option;
for (d=0;d<crawlername.length;d++)
{
option = new Option(crawlername[d],crawleraction[d]);
document.search.crawler.options[startcount] = option;
startcount++;
}
}

function initiateSearch(x)
{
var url;
url = x.crawler.options[x.crawler.selectedIndex].value+x.q.value;
self.location.href = url;
return (false);
}
//-->
</script>

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

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

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

40 posts views Thread by Brian Jorgenson | last post: by
5 posts views Thread by Kojak | last post: by
3 posts views Thread by Stephen Witter | last post: by
18 posts views Thread by len.hartley | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.