终于在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
2006-10-02 15:19
591 查看
现在Me公告栏里使用的代码
code: new_0.0.2
<script language="javascript">...
function on_search_click()...{
Form1.action = "http://www.google.com/custom?q=";
Form1.target = "_blank";
Form1.method = "get";
}
</script>
<!-- Search Google -->
<center>
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<br/>
<input type="text" name="q" size="23" maxlength="255" value=""></input>
</td></tr>
<tr><td valign="top" align="left">
<input type="submit" name="sa" value="Google 搜索" onclick="javascript:on_search_click()"></input>
<input type="hidden" name="client" value="pub-3938365705781251"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="0968900262"></input>
<input type="hidden" name="ie" value="utf-8"></input>
<input type="hidden" name="oe" value="GB2312"></input>
<input type="hidden" name="flav" value="0001"></input>
<input type="hidden" name="sig" value="191Qey090PRjYYr6"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:114;L:http://www.google.com/logos/Logo_60wht.gif;S:http://blog.csdn.net/clin003;FORID:1"></input>
<input type="hidden" name="hl" value="zh-CN"></input>
</td></tr></table>
</form>
</center>
<!-- Search Google -->
参考文章代码:给自己的Blog 上添加定制的搜索引擎
http://blog.csdn.net/smile2me27/archive/2004/07/08/37008.aspx
<script language="javascript">...
function on_search_click()...{
Form1.action = "http://www.google.com/custom/";
Form1.target = "_blank";
Form1.method = "get";
}
</script>
<!-- Search Google -->
<center>
<table cellspacing="0" border="0">
<tr><td>Google 查询:</td></tr>
<tr valign="top"><td>
<input type="text" name="q" maxlength="255" value="" style="width:130px;border:3px double #cecece;">
<input type="submit" name="sa" value="Search" onclick="javascript:on_search_click()">
<input type="hidden" name="cof" value="AH:center;AWFID:3182aae82da4ddf8;">
<input type="hidden" name="ie" value="GB2312">
<input type="hidden" name="oe" value="GB2312">
<input type="hidden" name="domains" value="blog.csdn.net"><br>
<input type="radio" name="sitesearch" value=""> By WWW
<input type="radio" name="sitesearch" value="blog.csdn.net" checked="checked"> By Me
</td></tr></table>
</center>
<!-- Search Google -->
<br>
code: new_0.0.1
<!-- Search Google -->
<div style="text-align: left;">
<script type="text/javascript">...
function searchGoogle(key,evt,site)
...{
if(evt.keyCode==13 || evt.keyCode==0 || evt.type =='click')
...{
key.focus();
var keystr = key.value;
url = "http://www.google.com/custom?q=";
url = url + keystr;
url += "&sa=Google+%E6%90%9C%E7%B4%A2&client=pub-3938365705781251&forid=1&channel=0968900262&ie=GB2312&oe=GB2312&flav=0001&sig=191Qey090PRjYYr6&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3AFFFFFF%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BLH%3A50%3BLW%3A114%3BL%3Ahttp%3A%2F%2Fwww.google.com%2Flogos%2FLogo_60wht.gif%3BS%3Ahttp%3A%2F%2Fblog.csdn.net%2Fclin003%3BFORID%3A1&hl=zh-CN";
window.location=url;
return false;
}
}
</script>
<input style="width: 130px" type="text" name="q" size="23" maxlength="255" id="q"
onkeydown="return SearchGoogle(document.getElementById
('q'),event,'blog.csdn.net/clin003/')" />
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
</td></tr>
<tr><td valign="top" align="left">
<input onclick="searchGoogle(document.getElementById
('q'),event,'blog.csdn.net/clin003/')" type="button"
value="Google 搜索" name="sa" />
</td></tr></table>
</div>
<!-- Search Google -->
由于可以在 url 变量里 直接加上自定义google搜索参数,就省啦下面这大段代码
<input type="hidden" name="client" value="pub-3938365705781251"></>
<input type="hidden" name="forid" value="1"></>
<input type="hidden" name="channel" value="0968900262"></>
<input type="hidden" name="ie" value="GB2312"></>
<input type="hidden" name="oe" value="GB2312"></>
<input type="hidden" name="flav" value="0001"></>
<input type="hidden" name="sig" value="191Qey090PRjYYr6"></>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:114;L:http://www.google.com/logos/Logo_60wht.gif;S:http://blog.csdn.net/clin003;FORID:1"></>
<input type="hidden" name="hl" value="zh-CN"></>
如果想使用google主站的风格,可以把他的“参数”抄过来,
我的公告栏里的代码参考自:http://blog.csdn.net/blogdevteam/archive/2006/05/29/760124.aspx
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<div style="text-align: left;">
<script type="text/javascript">...
function searchGoogle(key,evt,site)
...{
if(evt.keyCode==13 || evt.keyCode==0 || evt.type =='click')
...{
key.focus();
var keystr = key.value;
url = "http://www.google.com/search?q=";
url = url + keystr;
url += "&ie=UTF-8&oe=GB2312&hl=zh-CN&domains="+site+"&sitesearch="+site;
window.location=url;
return false;
}
}
</script>
<input style="width: 130px" type="text" name="q" id="q" onkeydown="return SearchGoogle(document.getElementById('q'),event,'blog.csdn.net')" />
<input onclick="searchGoogle(document.getElementById('q'),event,'blog.csdn.net')" type="button"
value="搜索" name="sa" />
</div>
原来google提供的代码搜索没反应,开发小组称:
经查证,该问题是asp.net的server端form导致的,解决此问题请使用如上代码:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
原本google提供的代码是如下:
<!-- Search Google -->
<center>
<form method="get" action="http://www.google.cn/custom" target="google_window">
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<br/>
<input type="text" name="q" size="23" maxlength="255" value=""></input>
</td></tr>
<tr><td valign="top" align="left">
<input type="submit" name="sa" value="Google 搜索"></input>
<input type="hidden" name="client" value="pub-3938365705781251"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="0968900262"></input>
<input type="hidden" name="ie" value="GB2312"></input>
<input type="hidden" name="oe" value="GB2312"></input>
<input type="hidden" name="flav" value="0001"></input>
<input type="hidden" name="sig" value="191Qey090PRjYYr6"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:114;L:http://www.google.com/logos/Logo_60wht.gif;S:http://blog.csdn.net/clin003;FORID:1"></input>
<input type="hidden" name="hl" value="zh-CN"></input>
</td></tr></table>
</form>
</center>
<!-- Search Google -->
code: new_0.0.2
<script language="javascript">...
function on_search_click()...{
Form1.action = "http://www.google.com/custom?q=";
Form1.target = "_blank";
Form1.method = "get";
}
</script>
<!-- Search Google -->
<center>
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<br/>
<input type="text" name="q" size="23" maxlength="255" value=""></input>
</td></tr>
<tr><td valign="top" align="left">
<input type="submit" name="sa" value="Google 搜索" onclick="javascript:on_search_click()"></input>
<input type="hidden" name="client" value="pub-3938365705781251"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="0968900262"></input>
<input type="hidden" name="ie" value="utf-8"></input>
<input type="hidden" name="oe" value="GB2312"></input>
<input type="hidden" name="flav" value="0001"></input>
<input type="hidden" name="sig" value="191Qey090PRjYYr6"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:114;L:http://www.google.com/logos/Logo_60wht.gif;S:http://blog.csdn.net/clin003;FORID:1"></input>
<input type="hidden" name="hl" value="zh-CN"></input>
</td></tr></table>
</form>
</center>
<!-- Search Google -->
参考文章代码:给自己的Blog 上添加定制的搜索引擎
http://blog.csdn.net/smile2me27/archive/2004/07/08/37008.aspx
<script language="javascript">...
function on_search_click()...{
Form1.action = "http://www.google.com/custom/";
Form1.target = "_blank";
Form1.method = "get";
}
</script>
<!-- Search Google -->
<center>
<table cellspacing="0" border="0">
<tr><td>Google 查询:</td></tr>
<tr valign="top"><td>
<input type="text" name="q" maxlength="255" value="" style="width:130px;border:3px double #cecece;">
<input type="submit" name="sa" value="Search" onclick="javascript:on_search_click()">
<input type="hidden" name="cof" value="AH:center;AWFID:3182aae82da4ddf8;">
<input type="hidden" name="ie" value="GB2312">
<input type="hidden" name="oe" value="GB2312">
<input type="hidden" name="domains" value="blog.csdn.net"><br>
<input type="radio" name="sitesearch" value=""> By WWW
<input type="radio" name="sitesearch" value="blog.csdn.net" checked="checked"> By Me
</td></tr></table>
</center>
<!-- Search Google -->
<br>
code: new_0.0.1
<!-- Search Google -->
<div style="text-align: left;">
<script type="text/javascript">...
function searchGoogle(key,evt,site)
...{
if(evt.keyCode==13 || evt.keyCode==0 || evt.type =='click')
...{
key.focus();
var keystr = key.value;
url = "http://www.google.com/custom?q=";
url = url + keystr;
url += "&sa=Google+%E6%90%9C%E7%B4%A2&client=pub-3938365705781251&forid=1&channel=0968900262&ie=GB2312&oe=GB2312&flav=0001&sig=191Qey090PRjYYr6&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3AFFFFFF%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BLH%3A50%3BLW%3A114%3BL%3Ahttp%3A%2F%2Fwww.google.com%2Flogos%2FLogo_60wht.gif%3BS%3Ahttp%3A%2F%2Fblog.csdn.net%2Fclin003%3BFORID%3A1&hl=zh-CN";
window.location=url;
return false;
}
}
</script>
<input style="width: 130px" type="text" name="q" size="23" maxlength="255" id="q"
onkeydown="return SearchGoogle(document.getElementById
('q'),event,'blog.csdn.net/clin003/')" />
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
</td></tr>
<tr><td valign="top" align="left">
<input onclick="searchGoogle(document.getElementById
('q'),event,'blog.csdn.net/clin003/')" type="button"
value="Google 搜索" name="sa" />
</td></tr></table>
</div>
<!-- Search Google -->
由于可以在 url 变量里 直接加上自定义google搜索参数,就省啦下面这大段代码
<input type="hidden" name="client" value="pub-3938365705781251"></>
<input type="hidden" name="forid" value="1"></>
<input type="hidden" name="channel" value="0968900262"></>
<input type="hidden" name="ie" value="GB2312"></>
<input type="hidden" name="oe" value="GB2312"></>
<input type="hidden" name="flav" value="0001"></>
<input type="hidden" name="sig" value="191Qey090PRjYYr6"></>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:114;L:http://www.google.com/logos/Logo_60wht.gif;S:http://blog.csdn.net/clin003;FORID:1"></>
<input type="hidden" name="hl" value="zh-CN"></>
如果想使用google主站的风格,可以把他的“参数”抄过来,
我的公告栏里的代码参考自:http://blog.csdn.net/blogdevteam/archive/2006/05/29/760124.aspx
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<div style="text-align: left;">
<script type="text/javascript">...
function searchGoogle(key,evt,site)
...{
if(evt.keyCode==13 || evt.keyCode==0 || evt.type =='click')
...{
key.focus();
var keystr = key.value;
url = "http://www.google.com/search?q=";
url = url + keystr;
url += "&ie=UTF-8&oe=GB2312&hl=zh-CN&domains="+site+"&sitesearch="+site;
window.location=url;
return false;
}
}
</script>
<input style="width: 130px" type="text" name="q" id="q" onkeydown="return SearchGoogle(document.getElementById('q'),event,'blog.csdn.net')" />
<input onclick="searchGoogle(document.getElementById('q'),event,'blog.csdn.net')" type="button"
value="搜索" name="sa" />
</div>
原来google提供的代码搜索没反应,开发小组称:
经查证,该问题是asp.net的server端form导致的,解决此问题请使用如上代码:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
原本google提供的代码是如下:
<!-- Search Google -->
<center>
<form method="get" action="http://www.google.cn/custom" target="google_window">
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<br/>
<input type="text" name="q" size="23" maxlength="255" value=""></input>
</td></tr>
<tr><td valign="top" align="left">
<input type="submit" name="sa" value="Google 搜索"></input>
<input type="hidden" name="client" value="pub-3938365705781251"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="0968900262"></input>
<input type="hidden" name="ie" value="GB2312"></input>
<input type="hidden" name="oe" value="GB2312"></input>
<input type="hidden" name="flav" value="0001"></input>
<input type="hidden" name="sig" value="191Qey090PRjYYr6"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:114;L:http://www.google.com/logos/Logo_60wht.gif;S:http://blog.csdn.net/clin003;FORID:1"></input>
<input type="hidden" name="hl" value="zh-CN"></input>
</td></tr></table>
</form>
</center>
<!-- Search Google -->
相关文章推荐
- 在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
- 在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
- 在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
- 在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
- 在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
- 在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
- 在公告栏里加进啦Google自定义搜索引擎(附代码,和参考代码,原代码)
- 【计服15】实验三参考代码
- 《多任务下的数据结构与算法》一书中的红黑树的测试代码,供读者参考!
- 织梦内容管理系统模板标签代码参考
- FormData使用,上传图片和对象信息(参考代码)
- 课后作业代码参考
- C#.NET 可以为不同的客户定制不同的登录窗体的设计思路参考【功能代码组件化,可以灵活选配】
- activemq 点对点demo [代码参考]
- 附件(blob)下载输出实例代码参考
- 历时八天,终于弄完了,此代码堪称完美,无懈可击,哈哈哈,图片库最终版js文件
- vs vc++ 开发 windows 服务的参考文章及代码网址
- combox改进版 页面原型参考dojo的,比网上jQuery的那些combox功能强,代码更小
- HDOJ 1880 魔咒词典 参考代码
- js实现 菜单iframe与主页面iframe 重叠 防止互相遮挡 代码参考