Intra-site search code for Google, Baidu, and Yahoo

Source: Internet
Author: User
Tags website server

For a website, using a search engine for intra-site search is more efficient than self-compiled intra-site search, and does not occupy the resources of the website server, the following is the intra-site search code of several major search engines I have collected (Google, Baidu, and Yahoo, you only need to replace "www.jb51.net" in the Code with your website address.

<! -- Start searching on the Google site -->
<Form method = get action = "http://www.google.com/search">
<Input type = text name = q>
<Input type = submit name = btnG value = "Google Search">
<Input type = hidden name = ie value = GB2312>
<Input type = hidden name = oe value = GB2312>
<Input type = hidden name = hl value = zh-CN>
<Input type = hidden name = domains value = "www.jb51.net">
<Input type = hidden name = sitesearch value = "www.jb51.net">
</Form>
<! -- Google site search ends -->

<! -- Baidu Site Search Start -->
<Form action = "http://www.baidu.com/baidu">
<Input type = text name = word>
<Input type = "submit" value = "Baidu search">
<Input name = tn type = hidden value = "bds">
<Input name = cl type = hidden value = "3">
<Input name = ct type = hidden value = "2097152">
<Input name = si type = hidden value = "www.jb51.net">
</Form>
<! -- Baidu intra-site search ends -->

<! -- Start searching on the Yahoo site -->
<Form action = "http://www.yahoo.com.cn/search">
<Input type = text name = "p">
<Input type = "submit" value = "Yahoo Search">
<Input type = hidden name = vs value = "www.jb51.net">
</Form>
<! -- Yahoo website search ended -->

The following is the site search code for Google and Baidu's Javascript version:

<! -- Start searching on the Google site -->
<Script type = "text/javascript">
Function googlesearch (){
Var wq = document. getElementsByName ("wq") [0]. value;
Varlink = "http://www.google.com/search? Domains = www.jb51.net & sitesearch = www.jb51.net & q = "+ wq;
Window. open (link );}
</Script>
<Input type = "text" name = "wq"/> <input type = "submit" onclick = "javascript: googlesearch ()" value = "Google Search"/>
<! -- Google site search ends -->

<! -- Baidu Site Search Start -->
<Script language = "javascript">
Function baidusearch (){
Var wd = document. getElementsByName ("wd") [0]. value;
Var link = "http://www.baidu.com/s? Si = www.jb51.net & cl = 3 & ct = 2097152 & tn = baidulocal & word = "+ wd;
Window. open (link );}
</Script>
<Input type = "text" name = "wd"/> <input type = "submit" onclick = "javascript: baidusearch ()" value = "Baidu search"/>
<! -- Baidu intra-site search ends -->

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.