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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HeLP!! How to create a search box to search within my own website

    [FONT=Times New Roman]undefined[/FONundefinedT]

    Hi.

    I am creating a website and I wanted to know the javascript for creating a search box that searches ONLY within my own website (no searching search engines) ?? I want to place a search box on every page of my website. I would really appreciate anyone who could help me out with this. THanks!

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I don't understand

    Hi Alien51.

    I went to the site you replied with. But i don't see where i would put the URL for my website? Can you help me with that? (i'm sorry, im a newbie,so i don't quite know javascript too well, but thanks for helping me out! ) I really appreciate it. Also, do you know how to modify this script provided in the link if i wanted to change the search box to ASP so that it would pull from the database? Thanks so much!!

    Anyone who can help, please do! Thanks in advance!

  • #4
    New Coder
    Join Date
    Dec 2003
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts
    umm...i'm not sure, but i think you dont need to enter your URL. it just searches the site you host it at

    not positive, just a guess

    try it out and see

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    You don't want google to search your site?
    Code:
    <form method="GET" action="http://www.google.com/search">
    <input type="text" name="q" size="31" maxlength="255" />
    <input type="submit" name="btnG" VALUE="Search" />
    <input type="hidden" name="domains" value="YOUR DOMAIN NAME" />
    <input type="hidden" name="sitesearch" value="YOUR DOMAIN NAME" />
    </form>

  • #6
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not exactly

    Hi Glenngy.

    Thanks for your coding, but this is not exactly what i wanted. I actually don't want a search engine results page, but i wanted to do a search within my website, where after a user types in keywords in the searchbox, the results would be displayed on another page, but still within my website. Thanks again though. CaN anyone else help??

    -j3nnif3r.

  • #7
    New Coder
    Join Date
    Jun 2004
    Location
    Lyon
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Quote Originally Posted by j3nnif3r
    Hi Glenngy.

    Thanks for your coding, but this is not exactly what i wanted. I actually don't want a search engine results page, but i wanted to do a search within my website, where after a user types in keywords in the searchbox, the results would be displayed on another page, but still within my website. Thanks again though. CaN anyone else help??

    -j3nnif3r.
    You can install a search engine like phpdig, but then again it needs some fiddling'n'tweaking maybe you were looking for a click'n'go solution?

  • #8
    New Coder
    Join Date
    Nov 2003
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Perhaps you could code a script the spiders the dom on each page and returns results based on single keyword finds.

    In this situation your going to have to have a configuration file to list the pages that you need your spider to be able to search.

    Then again you could code it so it would only search logical internal links on your site. Load all the links from the DOM then loop through them, store the pages you already searched, then visit the new links and search that dom for more links, all while maintaining a single array of already searched pages. Have it continue the process untill it no longer finds any links.

  • #9
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search box

    Hi Faxm0dem and Slysecretspy. For faxm0dem, i wanted to use javascript and an asp database for creating the searchbox, but would you like to post the scipt for the scenario you described? For Slysecretspy, could you also post scripts for the different cases/scenarios you described? Thanks again.


    -j3nnif3r.

  • #10
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Quote Originally Posted by j3nnif3r
    Hi Glenngy.

    Thanks for your coding, but this is not exactly what i wanted. I actually don't want a search engine results page, but i wanted to do a search within my website, where after a user types in keywords in the searchbox, the results would be displayed on another page, but still within my website. Thanks again though. CaN anyone else help??

    -j3nnif3r.
    The code I posted will do a Google search in YOUR site only. You only have to add form target to open the search result in a new window.

    <form method="GET" action="http://www.google.com/search" target="_blank">

    Unless your site is an intranet or you want your own search layout, you can use that code without the need for server-side scripting.

  • #11
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HI Glengy

    I understand what you meant in your coding, but i dont think i correctly stated what i wanted. Your script is very helpful, but i was wondering if i was able to do a search, where the header did not appear as "google" or any other search engine. Thanks again.

    -j3nnif3r.

  • #12
    New Coder
    Join Date
    Jun 2004
    Location
    Lyon
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb

    Quote Originally Posted by j3nnif3r
    Hi Faxm0dem and Slysecretspy. For faxm0dem, i wanted to use javascript and an asp database for creating the searchbox, but would you like to post the scipt for the scenario you described? For Slysecretspy, could you also post scripts for the different cases/scenarios you described? Thanks again.


    -j3nnif3r.
    won't help you much I guess if you're using asp this scipt I'm talking of is php.
    never mind here it is, there's even a demo available on the site:

    http://www.phpdig.net/

  • #13
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts

  • #14
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Take a look at the search I use on my site, is this what you are after

    This was coded by Jamie Jaworski and it is pretty easy to set up

    www.huntingground.freeserve.co.uk

    Click Search Me in the left menu

  • #15
    New Coder
    Join Date
    Jun 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    HI Mr. J. The search box is very close to what i want. I was wondering if there was someway to modify the search?? So that there is only the search box where the user can type in the keyword, but no selecting multiple keywords box and no options on the side (no select keywords from list option, or match any keyword, or match all keywords). Basically, im asking if the code can be modified for just the rectangle box for the user to type in keyword(s) and the search button. Is that possible?? Thanks again for your help. I greatly appreciate it.

    -j3nnif3r.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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