View Full Version : Multi-site searching via one search window

10-21-2010, 01:10 AM
Hey folks. I'm hoping someone can help with what seems like some fairly simple coding.

I'd like to create an HTML document with a "universal search box" so that I can enter my search terms, then have them inserted into the search strings for various sites, which would open in new tabs.

Kinda like this:

Search terms: "Election+coverage"

New tab #1:

New tab #2:

So basically, after I enter my terms into the search box and hit ENTER, I need the page to take what's in that search box, insert it into several pre-defined URLs, then open each URL in a new tab.

I can't call myself a programmer by any means, though I do know some basic HTML. Is this something that would take a lot of effort to do? If not, any ideas about how to accomplish this would be much appreciated!

10-21-2010, 03:44 AM
You could do something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
var sites = [

function openQuery(q)
//this will only open a new tab if the user's browser is configured that way
for (var i=0;i<sites.length;i++) window.open(sites[i].replace('[QUERY]',q));

window.onload = function()
document.getElementById('submit_query_btn').onclick = function()

<input id="query_input" type="text" />
<input id="submit_query_btn" type="button" value="query" />


10-21-2010, 05:30 AM
Yes! That's EXACTLY what I was looking for. Thanks! :)