Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Jul 2005
    Location
    San Jose
    Posts
    2

    Search engine question

    Hello!

    I have a question regarding your search engine script here: http://www.mediacollege.com/internet...ti-search.html

    Near the buttom of the page its mentioned that some search engine places the search terms in the middle of the query. I've run into that particular instance and was wondering if you can give a quick example of how something like that can be done.

    I thank you in advance for any help you can provide. I'm still learning all this crazy stuff

    -james
    Last edited by chipeat; 19th Jul 2005 at 19:00. Reason: wrong url

  2. #2
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    This gets a little tricky and there are no guarantees, but in essence you need to create another variable for the part of the URL which comes after the search terms. In this case I've called the variable "rest_of_url":

    Code:
    <script language="JavaScript">
    function dosearch() {
    var sf=document.searchform;
    var rest_of_url = "(the last part of the URL)";
    var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value) + rest_of_url;
    window.location.href = submitto;
    return false;
    }
    </script>
    It's worth noting that in a lot of cases this last part of the URL isn't actually necessary. Try it without and see what happens.
    Dave Owen
    MediaCollege.com

  3. #3
    Member
    Join Date
    Jul 2005
    Location
    San Jose
    Posts
    2
    This works great!

    How would I add multiple search engines (Google, Yahoo, etc.,) that require the search terms in the middle of the query?

    Thanks alot for all your help!

  4. #4
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    If the search engines all use different types of URL, I would recommend setting up a different function for each of them. When you run the script, it decides which search engine you want and sends you to the appropriate function. For example:

    Code:
    function dosearch() {
    var which_engine = sf.sengines.options[sf.sengines.selectedIndex].value;
    if (which_engine == "google") {
       googlesearch();
       } else if (which_engine == "yahoo") {
       yahoosearch();
       } else {
       genericsearch();
       }
    }
    
    function googlesearch() {
      // code for google search
    }
    function yahoosearch() {
      // code for yahoo search
    }
    function genericsearch() {
      // code for generic search
    }
    Dave Owen
    MediaCollege.com

  5. #5

    Thanx "Dave Owen"

    Reg: "How to Make a Search Form With Multiple Search Options"
    Some one put it in words i allmost understand..*gg*

    But as usual with me,i wanna create a little "script" thats way over my "skill level" he he..
    U se, i have been using "copernic meta" for a while now and there for have quite a list of xtreme usefull "search engine query url`s".
    I have exportet the list from windows Reg. and tried as you describe in the post.. but i will never get this right.. that im sure of now.. *gg*
    Mabye if im luckey,Ill get a pro to do it for me?? like maby you..

    this is the url`s:
    HTML Code:
    http://www.alltheweb.com/search?opt_name=offensive&_sb_lang=any&cs=utf-8&cat=web&copt_offensive=on&q=%encoded_utf8_query%&avkw=fogg&ocjp=1
    http://bigsearch.safehouse.mine.nu/cgi-bin/srchen.cgi
    http://download.com.com/3120-20-0.html?qt=%query%&tg=dl-2001
    http://www.simtel.net/search.php
    http://www.snapfiles.com/downloadfind.php?action=s&st=%QUERY%
    http://www.ratite.com/whois/whois.cgi?domain=%query%
    http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=%encoded_utf8_query%
    http://groups.google.com/groups?q=%encoded_utf8_query%&ie=UTF-8&oe=UTF-8&hl=en
    http://www.ultimate-guitar.com/search.php3?ss=%QUERY%&location=bands
    http://www.hotscripts.com/search/index.html
    http://www.scriptsearch.com/cgi-bin/search.cgi?searchfrom=left&q=%QUERY%&submit=Go%21
    http://www.scripts.com/index.php?option=search
    http://search.lyrics.astraweb.com/?word=%QUERY%
    http://ftp.zcu.cz/ftp/pub/win/?query=%QUERY%
    http://search.microsoft.com/search/results.aspx?View=msdn&st=a&c=0&s=1&qu=%encoded_utf8_query%
    http://turdinc.kicks-ass.net/Msntv/msn2.html?input1=%QUERY%
    http://search.msn.com/results.asp?RS=CHECKED&FORM=MSNH&v=1&q=%encoded_utf8_query%
    http://music.msn.com/search/all/?ss=%QUERY%
    http://search.windowsmedia.com/search/mgsearch.aspx?srch=%QUERY%&WMPFriendly=false&culture=en-gb&version=&btnSearch=Search
    http://s.lomalka.ru/s?q=%QUERY%&lang=en
    http://keygen.ru/search.shtml?str=%QUERY%&w=keygen.ru
    http://astakiller.com/?srch=%QUERY%
    http://astalavista.box.sk/cgi-bin/robot?srch=%QUERY%
    http://justddl.com/cracksearch.php?query=%QUERY%
    http://justddl.com/index.php?q=%QUERY%
    http://kadets.ru/search/search.php?q=%QUERY%&r=10
    http://www.projectw.org/search.php?mode=results
    http://www.filehash.com/search.html?pattern=%QUERY%&s=&st=ad&g=&min_size=&max_size=&submit=Find
    http://www2.fixdown.com/fixdown/enquery.asp
    http://www.shareodie.com/forum/index.php?act=Search&CODE=01
    http://soft-best.net/en/search.php
    http://soft.ttdown.com/Search_Soft.asp
    http://vanix.net/search.php?search=%QUERY%
    http://www.projectw.org/search.php?mode=results
    http://www.warezproject.org/search.php
    http://webwarez.net/search.php?whr=All&sch=%QUERY%&submit=Find
    http://www.wqsky.com/enquery.asp

    they can all have ">******<options>
    ill give them names myself later... i would be FOREVER in your service if you`ll do this for me... cause i give up now.. you dont know how long i have been tampering with this "How to Make a Search Form With Multiple Search Options" script thing.. but im starting to feel pretty dumb...*gg* it just wont work

    PS:your so right on that Fahrenheit 9/11 topic.. and the "My 5 cents -- My Views on Cannabis" ...

    I know that this post proberly souldent be postet here.. but i couldent find any email to you here or on your personal page..

    Thanks beforhand
    Last edited by [-BlAsTrIX-]; 19th Aug 2005 at 22:07. Reason: Forgot to tell who its for.. lol

  6. #6
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    Sorry about the delayed reply BlAsTrIX. To be honest your question looked too difficult and I've been putting it off.

    I'm not completely sure what you're trying to do. Do you just want a search form which can search any of the listed search engines, or is there something else I've missed?

    In any case it does look like a fairly big job - could be quite a lot of time involved in this one.

    PS Thanks for your comments about my personal site
    Dave Owen
    MediaCollege.com

  7. #7

    Ok! How about this then??

    i think i found a nother way of doing this,by using the "form" you guys have HERE
    As it is now,the "form" knows that it sould put the "search-word" after "?q=" (option value 1)

    but i would like to also make the "form" understand that the word
    Code:
    %QUERY%
    also should be replaced by the "search-word" ( see option value 2) ,because as you see in option value 2 there has to be somthing written AFTER the "search-word"

    Code:
    <html> 
    
    <head> 
    <title>multi-search</title> 
    
    <script language="JavaScript"> 
    function dosearch() { 
    var sf=document.searchform; 
    var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value); 
    window.location.href = submitto; 
    return false; 
    } 
    </script> 
    
    </head> 
    <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red"> 
    
    <form name="searchform" onSubmit="return dosearch();"> 
    Search: 
    <select name="sengines"> 
    <option value="http://www.google.com/search?q=" selected>Google</option> 
    <option value="http://kadets.ru/search/search.php?q=%QUERY%&r=10">kadets</option> 
    </select> 
    For: 
    <input type="text" name="searchterms"> 
    <input type="submit" name="SearchSubmit" value="Search"> 
    </form> 
    
    </body> 
    
    </html>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Subscribe to us on YouTube