返回列表 回复 发帖

怎样在网页中加入baidu和google的搜索功能

我要在自己的网页里加入 baidu.和google的那个搜功能进去,应怎样做啊!
要用到数据库吗??
不用的,到百度网站里,选查看源文件,把相关搜索的代码拷到你相应的页面即可
那具体应该怎么做,可以说得详细一点吗?
搜索大全,放在body之間
============================
<!-- ---------搜索大全-------------- -->
<script>
function search4()
{
if(form1.abc0.checked)
window.open("http://search.sina.com.cn/cgi-bin/search/search.cgi?_searchkey="+form1.key.value,"mspg0");
if(form1.abc1.checked)
window.open("http://site.search.sohu.com/sitesearch.jsp?page_index=0&key_word="+form1.key.value,"mspg1");
if(form1.abc2.checked)
window.open("http://cn.search.yahoo.com/search/cn?p="+form1.key.value,"mspg2");
if(form1.abc3.checked)
window.open("http://www.skycn.com/search.php?sor=00&ss_name="+form1.key.value,"mspg3");
if(form1.abc4.checked)
window.open("http://www.google.com/search?hl=zh-CN&lr=lang_zh-CN&q="+form1.key.value,"mspg4");
if(form1.abc5.checked)
window.open("http://search.yahoo.com/bin/search?p="+form1.key.value,"mspg5");
if(form1.abc6.checked)
window.open("http://www.baidu.com/baidu?tn=sitehao123&word="+form1.key.value,"mspg6");
if(form1.abc7.checked)
window.open("http://mp3search.baidu.com/wstsearch?tn=baidump3&ct=134217728&lm=-1&rn=&word="+form1.key.value,"mspg7");
if(form1.abc8.checked)
window.open("http://search.sogua.com/search/search.asp?fmp3=1&frm=1&fwma=1&fasf=1&go.x=25&go.y=19&key="+form1.key.value,"mspg8");
if(form1.abc9.checked)
window.open("http://mp3search.baidu.com/wstsearch?tn=baidump3lyric&ct=150994944&lm=-1&rn=&word="+form1.key.value,"mspg9");
if(form1.abc10.checked)
window.open("http://pic.sina.com.cn/cgi-bin/retr/search?query="+form1.key.value,"mspg10");
if(form1.abc11.checked)
window.open("http://www.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&word="+form1.key.value,"mspg11");
if(form1.abc12.checked)
window.open("http://bingle.pku.edu.cn/scripts/ftp_search.exe?cdtype=GB&word="+form1.key.value,"mspg12");
if(form1.abc13.checked)
window.open("http://flash.baidu.com/wstsearch?tn=flash&sort=time&rn=10&pn=0&cl=3&f=8&ct=33554432&word="+form1.key.value,"mspg13");
if(form1.abc14.checked)
window.open("http://cns.3721.com/cns.dll?fw=1&name="+form1.key.value,"mspg14");
return false;
}
</script>
<div align="center"><center>
<table width="760" height="64" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#99DF95"
bgcolor="#F0F7FF">
<tr>
<td width="730" height="3"><p align="center">宗合搜索<a href="search.htm"
target="_self">引擎</a></td>
</tr>
<tr>
<td width="730" height="50"><form name="form1" onsubmit="return(search4())">
<div align="center"><center><p>輸入關鍵字:<input type="text" name="key" size="15">
<input type="submit" style="COLOR:" rgb(0,0,0); FONT-SIZE: 9pt value="搜索" name="B2"> <input
type="checkbox" name="abc0" value="sina"><a href="ss/sina.htm">新浪</a> <input
type="checkbox" name="abc1" value="sohu"><a href="ss/sohu.htm">搜狐</a> <input
type="checkbox" name="abc2" value="yahoo"><a href="ss/cnyahoo.htm">雅虎</a> <input
type="checkbox" name="abc3" value="yeah"><a href="ss/soft.htm">軟件</a> <input
type="checkbox" name="abc4" value="3721" checked><a href="ss/google.htm">google</a> <input
type="checkbox" name="abc5" value="yahooe"><a href="ss/yahoo.htm">Yahoo</a> <input
type="checkbox" name="abc6" value="google" checked><a href="ss/baidu.htm">百度</a> <input
type="checkbox" name="abc7" value="baidump3"><a href="mp3s.htm">百度mp3</a><input type="checkbox" name="abc8"
value="baidump3"><a href="ss/souga.htm">搜刮mp3</a> <input type="checkbox" name="abc9"
value="baidump3">歌詞 <input type="checkbox" name="abc10" value="baidump3"><a
href="ss/sinapic.htm">新浪圖片</a> <input type="checkbox" name="abc11"
value="baidump3"><a href="ss/baidupic.htm">百度圖片</a> <input type="checkbox"
name="abc12" value="baidump3"><a href="ss/sky.htm">天网搜索</a>&nbsp; <input
type="checkbox" name="abc13" value="baidump3"><a href="ss/flashbaidu.htm">FLASH</a> <input
type="checkbox" name="abc14" value="baidump3"><a href="ss/3721.htm">3721</a></p>
</center></div>
</form>
</td>
</tr>
</table>
<!-- ------------------------------------- -->
<!--google搜索-->
<center>
<FORM method=GET action="http://www.google.com/search">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/intl/zh-CN/">
<IMG SRC="http://www.google.com/logos/Logo_40wht.gif"
border="0" ALT="Google" align="absmiddle"></A>
<INPUT TYPE=text name=q size=31 maxlength=255 value="">
<INPUT TYPE=hidden name=hl value=zh-CN>
<INPUT type=submit name=btnG value="Google 搜索">
</td></tr></TABLE>
</FORM>
</center>
<!-- ------------------------------------- -->
<!--白度搜索1-->
<form action="http://www1.baidu.com/baidu" method=get name="query" target="_blank">
<div align="center">
<input name=tn type=hidden value=baidu>
<a href="http://www.baidu.com/"><img src="http://www.baidu.com/images/baidu_logo.gif"
alt="Baidu" align="bottom" border="0"></a>
<input type=text name=word size=15>
<input type="submit" value="百度搜索">
</div>
</form>
<!-- ------------------------------------- -->
<!--白度搜索2-->
<SCRIPT language=javascript>
function gowhere1(formname)
{
var url;
if (formname.myselectvalue.value == "0")
{
url = "http://www1.baidu.com/baidu";
document.search_form1.tn.value = "baidu";
formname.method = "get";
}
if (formname.myselectvalue.value == "1")
{
url = "http://www.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 == "2")
{
document.search_form1.tn.value = "flash";
document.search_form1.ct.value = "33554432";
url = "http://www.baidu.com/f";
}
if (formname.myselectvalue.value == "3")
{
document.search_form1.tn.value = "baiduwstui";
document.search_form1.ct.value = "83886080";
url = "http://www.baidu.com/x";
}
if (formname.myselectvalue.value == "4")
{
document.search_form1.tn.value = "news";
document.search_form1.cl.value = "2";
document.search_form1.rn.value = "30";
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://www.baidu.com/i";
}
formname.action = url;
return true;
}
</SCRIPT>
<form name="search_form1" target="_blank" onsubmit="return gowhere1(this)">
<table width="100%" height="80" border="0" cellpadding="0" cellspacing="0" style=font-family:宋体><tr><td>
<TABLE width=68% height="80" border=0 align="center" cellPadding=0 cellSpacing=0>
<INPUT name=myselectvalue type=hidden value=0>
<INPUT name=tn type=hidden>
<INPUT name=ct type=hidden>
<INPUT name=lm type=hidden>
<INPUT name=cl type=hidden>
<INPUT name=rn type=hidden>
<TR>

<TD width="24%" valign="bottom"> <div align="right"><a href="http://www.baidu.com/"><img src="http://img.baidu.com/search/img/baidulogo_clarity_80_29.gif"
alt="Baidu" align="bottom" border="0"></a></div></TD>

<TD vAlign=bottom width="76%"> <div align="center">
<INPUT name=myselect onclick=javascript :this.form.myselectvalue.value=4; type=radio value=0>
<FONT color=#0000cc style="FONT-SIZE: 12px">新聞</FONT>
<INPUT CHECKED name=myselect onclick=javascript :this.form.myselectvalue.value=0; type=radio value=0>
<SPAN class=f12><FONT color=#0000cc style="FONT-SIZE: 12px">网頁</FONT></SPAN>
<INPUT name=myselect onclick=javascript :this.form.myselectvalue.value=1; type=radio value=1>
<SPAN class=f12><FONT color=#0000cc style="FONT-SIZE: 12px">mp3</FONT></SPAN>
<INPUT name=myselect onclick=javascript :this.form.myselectvalue.value=5; type=radio value=0>
<FONT color=#0000cc style="FONT-SIZE: 12px">圖片</FONT>
<INPUT name=myselect onclick=javascript :this.form.myselectvalue.value=2; type=radio value=2>
<SPAN class=f12><FONT color=#0000cc style="FONT-SIZE: 12px">flash</FONT></SPAN>
<INPUT name=myselect onclick=javascript :this.form.myselectvalue.value=3; type=radio value=3>
<SPAN class=f12><FONT color=#0000cc style="FONT-SIZE: 12px">信息快?<br>
</FONT></SPAN> </div>
<TABLE align=right border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD><div align="center"><FONT style="FONT-SIZE: 12px">
<input id=word name=word size="40">
</FONT>
<input type="submit" value="百度搜索">
</div></TD>

<td><br> </TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width="24%"> </TD>
<TD width="76%"> </TD>
</TR>
<td>
</TABLE></td>
</tr> </table></form>
<!-- ------------------------------------- -->

<SCRIPT language=javascript>
<!--
function go(formname)
{
var url = "http://www1.baidu.com/baidu";
formname.method = "get";
if (formname.myselectvalue.value == "1") {
document.search_form1.word.value = document.search_form1.word.value+" site:soneast.35123.net";
}
formname.action = url;
return true;
}
//-->
</SCRIPT>
<br>
使用本段代碼,您只需要用您的网站地址替換代碼中&quot;soneast.35123.net&quot;即可實現站內搜索功能 <br>
<form name="search_form1" target="_blank" onsubmit="return go(this)">
<input name=word size="30" value="輸入關鍵字" onMouseOver="this.focus()" onBlur="if (value ==’’){value=’輸入關鍵字’}" onFocus="this.select()" onClick="if(this.value==’輸入關鍵字’)this.value=’’">
<input type="submit" value="百度搜索"><br>
<INPUT name=myselectvalue type=hidden value=0>
<INPUT name=tn type=hidden value="baidu">
<INPUT name=cl type=hidden value="3">
<INPUT CHECKED name=myselect onclick=javascript :this.form.myselectvalue.value=0; type=radio value=0>
<FONT color=#0000cc style="FONT-SIZE: 12px">互聯网</FONT>
<INPUT name=myselect onclick=javascript :this.form.myselectvalue.value=1; type=radio value=1>
<FONT color=#ff0000 style="FONT-SIZE: 12px">soneast.35123.net站?</FONT>
</form>
返回列表