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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Google Internal Site Search Modifications

    I am using the following script:

    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>
    I want to modify the onSubmit event to also include this code:

    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.

    Thanks
    JR

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Add the following function to your javascript:

    Code:
    function newwind() {
    	window.open('', 'foo', 'width=450,height=300,status=yes,resizable=yes,scrollbars=yes');
    }
    And alter your form tag to look like this:

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

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

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