Custom search page for MSN-YAHOO-Google

G

Guest

Custom search page for MSN-YAHOO-Googl
i am trying to create a single page that has a single
dialog box and 3 submit buttons, 1 button per search
engine. The intent is for use on our intranet site and
the users can enter the search key words and the hit 1 of
3 buttons for the engine they would like to use. here is
what i have so far

<html><head><title>Search Page</title></head><body><script language=javascript><!-
function OnButton1(

document.Form.method = "get
document.Form.action
= "http://www.google.com/search
document.Form.target = "_blank"
document.Form.submit()
return true


function OnButton2(

document.Form.method = "get
document.Form.action
= "http://search.msn.com/results.aspx
document.Form.target = "_blank"
document.Form.submit()
return true

function OnButton3(

document.Form.method = "get
document.Form.action
= "http://search.yahoo.com/search
document.Form.target = "_blank"
document.Form.submit()
return true

--></script><form name=Form method=post><INPUT type="text" name="q" id="p" size="26"><br><INPUT type="button" value="Google" name=Submit
onclick="return OnButton1();"><INPUT type="button" value="MSN" name=Submit
onclick="return OnButton2();"><INPUT type="button" value="Yahoo" name=Submit
onclick="return OnButton3();"></form></body></html

With this code: msn-google work but not yahoo, search
results are opened in a new browser. The problem with
this is that the diffrent engines need a diffrent field
name for the submit value dialog box. name="p" for google
and name="q" for yahoo, the good news is that the msn
engine does not care about the field name and works with
any. I need to find a way to have multipule names for
the search criteria, or a way to have it mirrored and
submitted under both field names

Any help would be great

Thanks
Chris Coope
 
M

mortb

This seems to be a cinetscript post and not on the topic dotnet.framework.
Any way the search string for yahoo looks like this when I do a search for
aspnet:

http://search.yahoo.com/search?p=aspnet&ei=UTF-8&fr=fp-tab-web-t&cop=mss&tab=

What you can do is to change the location attribute of the page by
concatinating your own search string:

function OnButton3()
{
var searchString = "http://search.yahoo.com/search?p=" +
document.Form.q.value;
document.location = searchString;
}

and then you can create custom strings for every engine.

cheers,
mortb
 
J

John Young

Also, Google have a webservice that you can sign up for. That way you can
implement a search through your application


--
===============================
try
{
Linux (any version)
}
catch
{
Format (mainHardDisk)
Install (Windows2000/XP/2003)
}
// You know you want to !!!

John Young
 
G

Guest

The code works to search all 3 engines, but i dont seem to be able to open the yahoo search in a new window. Any help would be great

Thanks
Chris Coope


<html><head><title>Search Page</title></head><body><script language=javascript><!-
function OnButton1(

document.Form.method = "get
document.Form.action
= "http://www.google.com/search
document.Form.target = "_blank"
document.Form.submit()
return true


function OnButton2(

document.Form.method = "get
document.Form.action
= "http://search.msn.com/results.aspx
document.Form.target = "_blank"
document.Form.submit()
return true

function OnButton3(

var searchString = "http://search.yahoo.com/search?p=" + document.Form.q.value
document.location = searchString

--></script><form name=Form method=post><INPUT type="text" name="q" id="p" size="26"><br><INPUT type="button" value="Google" name=Submit onclick="return OnButton1();"><INPUT type="button" value="MSN" name=Submit onclick="return OnButton2();"><INPUT type="button" value="Yahoo" name=Submit onclick="return OnButton3();"></form></body></html>
 
M

mortb

For example:

function OnButton()
{
window.open("yourYahooURL?yourSearchParameters, "resizable=yes,
directories=yes, menubar=yes, status=yes, toolbar=yes, height=300,
width=400; ");
}

cheers,
mortb

Chris Cooper said:
The code works to search all 3 engines, but i dont seem to be able to open
the yahoo search in a new window. Any help would be great.
Thanks,
Chris Cooper



<html><head><title>Search Page</title></head><body><script language=javascript><!--
function OnButton1()
{
document.Form.method = "get"
document.Form.action
= "http://www.google.com/search"
document.Form.target = "_blank";
document.Form.submit();
return true;
}

function OnButton2()
{
document.Form.method = "get"
document.Form.action
= "http://search.msn.com/results.aspx"
document.Form.target = "_blank";
document.Form.submit();
return true;
}
function OnButton3()
{
var searchString = "http://search.yahoo.com/search?p=" + document.Form.q.value;
document.location = searchString;
}
--></script><form name=Form method=post><INPUT type="text" name="q" id="p"
size="26"><br><INPUT type="button" value="Google" name=Submit
onclick="return OnButton1();"><INPUT type="button" value="MSN" name=Submit
onclick="return OnButton2();"><INPUT type="button" value="Yahoo" name=Submit
onclick="return OnButton3();"></form></body></html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top