Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display Google Searh Results inside web page

    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

    Code:
    <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.

  • #2
    New Coder
    Join Date
    Jun 2011
    Location
    Algeirs,Algeria
    Posts
    43
    Thanks
    5
    Thanked 3 Times in 3 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •