...

View Full Version : Display Google Searh Results inside web page



jchap59
07-17-2011, 11:58 AM
Hi,

Apologies in advance but I have no experience of Javascript.

I found the following 'Cut & Paste Google Internal Site Search script' in the Javascriptkit.com library - it works well and provides an easy solution for adding a search function to a website - code below


<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
}

</script>


<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>

</form>

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

However, if possible, I would like to display the results inside the website structure rather than on a new page - is there an easy way to do this?

Thanks in advance for any help.

Hamza7
07-17-2011, 01:28 PM
Try to add target attribute to your form with value of "_self" or the name of the frame where you want to display the result page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum