冲浪网站优化网立足洛阳是国内知名SEO服务商,是网站优化SEO学习,SEO技巧方法知识获取重要平台,提供高效的SEO及网站优化解决方案,提高目标网站的网站排名。

全国热线电话:13633878273

冲浪网站优化 / Products Center

百度搜索代码和站内搜索代码下载

发布时间: 2014-09-03 21:23:20

百度向网友开放免费下载百度搜索代码。
只需将以下代码之一加入到您的网页中,您的网站即可获得同百度搜索引擎一样强大的搜索功能!

一、简约代码

下载代码:

<form action="http://www.baidu.com/baidu" target="_blank"><input name=tn type=hidden value=baidu><a href="http://www.baidu.com/"><img src="http://img.baidu.com/img/logo-80px.gif" alt="Baidu" align="bottom" border="0"></a><input type="text"  name="word"  size=30><input type="submit"  value="百度搜索"></td></tr></table></form>
 

二、标准代码

下载代码:

<script language="javascript">
function gowhere1(formname) {
var url;
if (formname.myselectvalue.value == "0") {
url = "http://www.baidu.com/baidu";
document.search_form1.tn.value = "baidu";
formname.method = "get";
}
if (formname.myselectvalue.value == "1") {
url = "http://mp3.baidu.com/m";
document.search_form1.tn.value = "baidump3";
document.search_form1.ct.value = "134217728";
document.search_form1.lm.value = "-1";
}

if (formname.myselectvalue.value == "4") {
document.search_form1.tn.value = "news";
document.search_form1.cl.value = "2";
document.search_form1.rn.value = "20";
url = "http://news.baidu.com/ns";
}
if (formname.myselectvalue.value == "5") {
document.search_form1.tn.value = "baiduiamge";
document.search_form1.ct.value = "201326592";
document.search_form1.cl.value = "2";
document.search_form1.lm.value = "-1";
url = "http://image.baidu.com/i";
}
if (formname.myselectvalue.value == "6") {
url = "http://tieba.baidu.com";
document.search_form1.tn.value = "baiduPostSearch";
document.search_form1.ct.value = "352321536";
document.search_form1.rn.value = "10";
document.search_form1.lm.value = "65536";
}

formname.action = url;
return true;
}
</script>
<form onsubmit="return gowhere1(this)" target="_blank" name="search_form1" method="get" action="http://www.baidu.com/baidu">
<table width="100%" height="80" cellspacing="0" cellpadding="0" border="0" style="font-family:宋体">
<tbody><tr>
<td>
<table width="144%" height="80" cellspacing="0" cellpadding="0" border="0">
<input type="hidden" value="0" name="myselectvalue">
<input type="hidden" value="utf-8" name="ie">
<input type="hidden" name="tn" value="baidu">
<input type="hidden" name="ct">
<input type="hidden" name="lm">
<input type="hidden" name="cl">
<input type="hidden" name="rn">
<tbody><tr>
<td width="8%" valign="bottom">
<div align="center">
<a href="http://www.baidu.com/">
<img border="0" align="bottom" alt="Baidu" src="http://img.baidu.com/img/logo-80px.gif">
</a>
</div>
</td>
<td width="92%" valign="bottom">

<input type="radio" value="0" onclick="javascript:this.form.myselectvalue.value=4;" name="myselect">
<font color="#0000cc">
新闻
</font>

<input type="radio" value="0" onclick="javascript:this.form.myselectvalue.value=0;" name="myselect" checked="">
<span class="f12">
<font color="#0000cc">
网页
</font>
</span>
<input type="radio" value="1" onclick="javascript:this.form.myselectvalue.value=1;" name="myselect">
<span class="f12">
<font color="#0000cc">
音乐
</font>
</span>
<input type="radio" value="0" onclick="javascript:this.form.myselectvalue.value=6;" name="myselect">
<font color="#0000cc">
贴吧
</font>

<input type="radio" value="0" onclick="javascript:this.form.myselectvalue.value=5;" name="myselect">
<font color="#0000cc">
图片
</font>

<table width="100%" cellspacing="0" cellpadding="0" border="0" align="right">
<tbody>
<tr>
<td style="padding-top:10px;">
<font>
<input size="40" name="word" id="word">
</font>
<input  type="submit" value="百度一下">

</td>
<td>
<br>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td width="8%"></td>
<td width="92%"></td>
</tr>

<tr>
<td>
</td></tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</form>
 

三、带站内搜索代码

通过百度实现站内搜索功能,只需要用您的网站地址替换代码中www.surfphpseo.com即可。

下载代码:

<SCRIPT language=javascript>
function g(formname)    {
    var url = "http://www.baidu.com/baidu";
    if (formname.s[1].checked) {
        formname.ct.value = "2097152";
    }
    else {
        formname.ct.value = "0";
    }
    formname.action = url;
    return true;
}
</SCRIPT><form name="f1" onsubmit="return g(this)"><table bgcolor="#FFFFFF" style="font-size:9pt;"><tr height="60"><td valign="top"><img src="http://img.baidu.com/img/logo-137px.gif" border="0" alt="baidu"></td><td><input name=word  size="30" maxlength="100"><input  type="submit" value="百度搜索"><br><input name=tn type=hidden value="bds"><input name=cl type=hidden value="3"><input name=ct type=hidden><input name=si type=hidden value=www.surfphpseo.com>
<div class="mt10"><input name=s type=radio> 互联网<input name=s type=radio checked> www.surfphpseo.com</div></td></tr></table></form>
 

提示:如果网页采用utf-8代码,则需要在代码中加入 <input name=ie type=hidden value=utf-8> ,否则搜索关键词会出现乱码。