Forum Moderators: open
Ultimately, this is best done with some 'back-end' stuff on your own server. It's not within client-side capabilities. However, it's possible to get Google to search your site for you.
When you want to restrict your search to a particular domain, you do this:
some search terms site:www.somesite.com
Try it in google to see what the results are for your own site. You'll see how the information is put together in a query string in the URL in the address bar, with some characters escaped, so you can see how to create your own queries. I have removed some of the language specifics, and cut it down to basics for this example:
<html>
<head>
<title>site search</title><script>
function search()
{
/* constants */
var google = "http://www.google.com/search";
var site = "+site%3Awww.webmasterworld.com";
/* search string */
var qString = "?q="+escape(document.getElementById("searchbox").value);
var loc = google + qString + site;
window.location = loc;
}
</script></head>
<body>
<input id="searchbox" type="text" size="30">
<button onclick="search()">search site</button>
</body>
</html>
Of course, you are relying on Google being up-to-date as regards your site. Not much you can do about that.
The only other alternative, without using server-side scripts, is to manually compile information (keywords etc) about your site, and put the information in a structured format in a javascript file.
You might try searching the web for "Atomz" - it's a search engine that you can use with your site. There are more like it, but this one lets you cusomize the look and generates reports about the things people search for - for a small site (<500 pages) it is free.
There's also the Google site search: [google.com...]
Javascript is not the right tool to use for that job ;)