/    Sign up×
Community /Pin to ProfileBookmark

need help adding a multi-search engine

ok, heres the deal…i want to add a multi-search engine to my site, the kind that has a drop down menu to select different engines to run it through (i.e. Google, IMDB, Dictionary.com…ect.), but i want it to have Google as the defaulted selection and to be able to just hit Enter to start the search.

i have one on my site now that has Google as the default, but when you click Enter it just resets the page, you have to actually click the button with the mouse. i dont know if the drop-down menu needs to be moved to the left side, or what, but it gets kind of annoying to hit Enter and it resests everything and you have to type it again. i guess i would also want it to focus on the input feild when the page loads.

thanks in advance for the help.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@neil9999Mar 12.2004 — Try making the button a <input type="submit">. Could you post your code please?

Neil
Copy linkTweet thisAlerts:
@vertigo_phreezeauthorMar 16.2004 — i modified a cut 'n' paste script i found on a website, here it is:

[COLOR=red]

<form method="get" name="log1">

<input type="text" name="T1" size="16" >

<SCRIPT LANGUAGE="JavaScript">



<!-- Begin

var g,ch;

function search()

{

g=document.log1.T1.value;

ch=document.log1.D1.value;

if(ch=="no")

{

alert("First select a site to search!");

document.log1.D1.focus();

}

if(ch=="1")

window.location="http://www.google.com/search?num=20&hl=en&lr=lang_en&ie=ISO-8859-1&newwindow=1&safe=off&q="+g+"&btnG=Google+Search";

if(ch=="2")

window.location="http://www.imdb.com/find?tt=on;nm=on;mx=20;q="+g;

if(ch=="3")

window.location="http://froogle.google.com/froogle?vnum=20&hl=en&lr=lang_en&ie=ISO-8859-1&newwindow=1&safe=off&q="+g+"&btnG=Google+Search&scoring=p";

if(ch=="4")

window.location="http://www.epinions.com/search/?submitted_form=searchbar&search_string="+g+"&tax_name=&dyn_nav=0&dyn_nav_id=&search_vertical=all";

if(ch=="5")

window.location="http://dictionary.reference.com/search?q="+g;

if(ch=="6")

window.location="http://thesaurus.reference.com/search?q="+g;

if(ch=="7")

window.location="http://images.google.com/images?svnum=20&hl=en&lr=lang_en&ie=ISO-8859-1&newwindow=1&safe=off&q="+g+"&btnG=Google+Search";

if(ch=="8")

window.location="http://download.com.com/sort/3120-20-0-1-4.html?qt="+g+"&ca=20";

}





// End -->



</script>



<select size="1" name="D1">

<option value="1">Google</option>

<option value="2">IMDB</option>

<option value="3">Froogle</option>

<option value="4">Epinions</option>

<option value="5">Dictionary</option>

<option value="6">Thesaurus</option>

<option value="7">Google Image</option>

<option value="8">Download.com</option>

</select>



<input type="button" name="search engine"


value="Search" onclick="search()" >

</form>

[/COLOR]


also, i am not married to this script by any means, if there is an easier way to do this, me being new to this, i am very willing to learn
×

Success!

Help @vertigo_phreeze spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...