网友summerfang反映不能在Blog公告栏加入Google搜索代码。

经查证,该问题是asp.net的server端form导致的,解决此问题请使用如下代码:

<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" />&nbsp;

<input  onclick="searchGoogle(document.getElementById('q'),event,'blog.csdn.net')" type="button"
                        value="搜索" name="sa" />
</div>

在您Blog中的呈现样式请自行调整。

相关文章:

  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2021-08-03
  • 2021-10-20
  • 2021-08-03
  • 2021-06-09
  • 2021-04-25
猜你喜欢
  • 2021-06-26
  • 2021-09-02
  • 2021-10-02
  • 2021-11-20
  • 2021-10-25
  • 2021-11-29
相关资源
相似解决方案