I have been searching for a Google Search Web Part that allows a user to type a search term in (and the results are displayed in a new browser window), so that users still keep the originating intranet page open. The solution I have chosen is Todd Bleeker’s Google Search Web Part: http://mindsharpblogs.com/todd/archive/2005/08/04/647.aspx .The zipped file contains the following file GoogleSearch.dwp . This web part needs to uploaded to the site:
Site Actions > Site Settings > Gallery > Web Parts
Once installed it can be added like any other web part. I made a minor alteration to search goggle.co.uk rather than .com. This was changed by modifying Google Search web part :
<script language="JavaScript">
function SubmitGoogleSearch()
{
var q = document.getElementById("q");
if(q && q.value.length > 0)
{
var newPage = document.getElementById("newPage");
if(newPage)
{
var url = "http://www.google.co.uk/search?q=" + q.value;
if(newPage.checked)
window.open(url);
else
document.location.href(url);
}
}
else
{
alert("Please enter one or more search words.");
}
}
</script>
<div onkeydown="JavaScript:if(event.keyCode==13) SubmitGoogleSearch();" nowrap><a href="http://www.google.co.uk" target="_blank"><IMG SRC="http://www.google.co.uk/nav_first.gif" border="0" align="top" alt="Google Search"></a>
<INPUT id="q" size="24" maxlength="254"><IMG SRC="/_layouts/images/icongo01.gif" border="0" align="absmiddle" style="cursor: hand" onclick="JavaScript:SubmitGoogleSearch();" accesskey="s" alt="Execute search"
ONMOUSEOVER="this.src='/_layouts/images/icongo02.gif'" ONMOUSEOUT="this.src='/_layouts/images/icongo01.gif'"
ONMOUSEDOWN="this.src='/_layouts/images/icongo03.gif'" ONMOUSEUP="this.src='/_layouts/images/icongo02.gif'"><input id="newPage" type="checkbox" CHECKED>New</div>
0 comments:
Post a Comment