<form action="http://www.google.com/search" name=f><span id=hf></span><table cellspacing=0 cellpadding=0><tr valign=middle><td width=75> </td><td align=center><input maxLength=256 size=55 name=q value="">
<script>
document.f.q.focus();
</script>
<input type=hidden name=ie value="UTF-8"><input type=hidden name=oe value="UTF-8"><input name=hl type=hidden value=zh-CN><br><input type=submit value="Google搜索" name=btnG><input type=submit value="手气不错" name=btnI></td><td valign=top nowrap><font size=-1> • <a href=http://www.google.com/advanced_search?hl=zh-CN>高级搜索</a><br> • <a href=http://www.google.com/preferences?hl=zh-CN>使用偏好</a><br> • <a href=http://www.google.com/language_tools?hl=zh-CN>语言工具</a></font></td></tr><tr><td colspan=3 align=center><font size=-1><input id=all type=radio name=lr value="" checked><label for=all>搜索所有网站</label><input id=ch type=radio name=lr value=lang_zh-CN|lang_zh-TW ><label for=ch>搜索所有中文网页</label><input id=il type=radio name=lr value=lang_zh-CN ><label for=il>搜索简体中文网页</label></font></td></tr></table></form>
<script>
document.f.q.focus();
</script>
<input type=hidden name=ie value="UTF-8"><input type=hidden name=oe value="UTF-8"><input name=hl type=hidden value=zh-CN><br><input type=submit value="Google搜索" name=btnG><input type=submit value="手气不错" name=btnI></td><td valign=top nowrap><font size=-1> • <a href=http://www.google.com/advanced_search?hl=zh-CN>高级搜索</a><br> • <a href=http://www.google.com/preferences?hl=zh-CN>使用偏好</a><br> • <a href=http://www.google.com/language_tools?hl=zh-CN>语言工具</a></font></td></tr><tr><td colspan=3 align=center><font size=-1><input id=all type=radio name=lr value="" checked><label for=all>搜索所有网站</label><input id=ch type=radio name=lr value=lang_zh-CN|lang_zh-TW ><label for=ch>搜索所有中文网页</label><input id=il type=radio name=lr value=lang_zh-CN ><label for=il>搜索简体中文网页</label></font></td></tr></table></form>
原理也不难,你只要知道如
何通过在服务器端,通过Socket
或HttpConnection连接到其他
搜索引擎就行了。
只有给你一点思路。你需要了解一下HttpConnection,
通过QueryString,找到具体的内容,
然后再解析出URL链接。
不是很复杂。网上可以找到例子。
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=144% height="80" border=0 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="8%" valign="bottom">
<DIV align=center><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="92%">
<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">信息快递
</FONT></SPAN> <TABLE align=right border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD><FONT style="FONT-SIZE: 12px">
<input id=word name=word size="40">
</FONT> <input type="submit" value="百度搜索">
</TD>
<td><br> </TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width="8%"> </TD>
<TD width="92%"> </TD>
</TR>
<td>
</TABLE></td>
</tr> </table></form>
这是百度的!
就限定在你的网站中搜索
<title>my search</title>
<script language="javascript">
var searchdomain,URL;
searchdomain = "www";
function checkIt(it){
searchdomain = it.value;
}
function submitIt(){
var searchvalue;
searchvalue = document.form.searchit.value;
if(searchvalue.length==0){
alert("searchvalue cann't is null");
return;
}
if(searchdomain.length==0){
alert("searchdomain cann't is null");
return;
}
if(searchdomain=="www"){
URL = "http://www.google.com/search?q="+searchvalue+"&ie=GB2312&hl=zh-CN&btnG=Google%CB%D1%CB%F7&lr=";
}else{
URL = "http://www.google.com/custom?q="+searchvalue+"&sitesearch="+searchdomain+"&hl=zh-CN&sa=Search&cof=L%3A%3BBGC%3A%23ffffff%3BAH%3Aleft%3BGL%3A0%3BS%3Ahttp%3A%2F%2Fwww"+searchdomain+"%3BAWFID%3Ac74cf53925b3abd3%3B&domains="+searchdomain ;
}
window.open(URL);
//this.location = URL;
}
</script>
function key(){ var keyCode=event.keyCode; if(keyCode==13 )
{
submitIt(); }
}
</script>
<body background="img/026.jpg" bgcolor="#ffffee">
<form name="form" action="my%20search.html">
<table name="table" align="center" bordercolor="#CCCCCC">
<tr><td colspan="2">
<input type="text" name="searchit" size="20" >
</td>
<tr>
<tr>
<td width="73"><font color="#000000">www:</font></td>
<td width="52">
<input type="radio" name="radio" value="www" checked onclick=checkIt(this)>
</td>
</tr>
<tr>
<td width="73"><font color="#000000">csdn:</font></td>
<td width="52">
<input type="radio" name="radio" value="csdn.net" onclick="checkIt(this)" >
</td>
</tr>
<tr>
<tr>
<td width="73"><font color="#000000">javaresearch:</font></td>
<td width="52">
<input type="radio" name="radio" value="javaresearch.org" onclick="checkIt(this)" >
</td>
</tr>
<tr>
<tr>
<td width="73"><font color="#000000">chinajavaworld:</font></td>
<td width="52">
<input type="radio" name="radio" value="chinajavaworld.net" onclick="checkIt(this)" >
</td>
</tr>
<tr>
<tr>
<td width="73"><font color="#000000">jdon:</font></td>
<td width="52">
<input type="radio" name="radio" value="jdon.com" onclick="checkIt(this)" >
</td>
</tr>
<tr>
<tr>
<td width="73"><font color="#000000">jguru:</font></td>
<td width="52">
<input type="radio" name="radio" value="jguru.com" onclick="checkIt(this)" >
</td>
</tr>
<tr>
<tr>
<td width="73"><font color="#000000">javaranch:</font></td>
<td width="52">
<input type="radio" name="radio" value="javaranch.com" onclick="checkIt(this)" >
</td>
</tr>
<tr>
<td width="73">
<td width="52">
<input type="submit" name="button" size="20" value="搜索" onclick="submitIt()">
<tr>
</table>
</html>
<script>
document.onkeydown=key
</script>