View Full Version : Google Internal Site Search Modifications

03-05-2009, 07:50 PM
I am using the following script:

<script type="text/javascript">

// Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use

//Enter domain of site to search.
var domainroot="www.javascriptkit.com"

function Gsitesearch(curobj){
curobj.q.value="site:"+domainroot+" "+curobj.qfront.value


<form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)">

<p>Search JavaScript Kit:<br />
<input name="q" type="hidden" />
<input name="qfront" type="text" style="width: 180px" /> <input type="submit" value="Search" /></p>


<p style="font: normal 11px Arial">This free script provided by<br />
<a href="http://www.javascriptkit.com">JavaScript Kit</a></p>

I want to modify the onSubmit event to also include this code:

window.open('', 'foo', 'width=450,height=300,status=yes,resizable=yes,scrollbars=yes')

But I am having difficulties. I would like for the search results page to be displayed in the new window.


03-05-2009, 08:10 PM
Add the following function to your javascript:

function newwind() {
window.open('', 'foo', 'width=450,height=300,status=yes,resizable=yes,scrollbars=yes');

And alter your form tag to look like this:

<form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)" target="newwind()">

Tested and works, though some browsers might override the settings for your new window. Enjoy.

03-05-2009, 09:02 PM
Thank you. And you are correct in that FF opens a new window full size instead of the specified width and height. :(

I may have to go with a different option.

Again...thanks. :)