原文链接:https://www.cnblogs.com/hardrock/archive/2008/01/26/1054281.html

把博客园的搜索设置移植到了页面顶端,这样让博客的搜索功能更加醒目。
同时整合了“Adsense for Search” 以及“Add related keyword links”(添加相关关键字链接,起到搜索提示的功能)。
下面是我使用的代码:

<script language="JavaScript">
function SearchGoogle(key,evt,site)
        {
            if(evt.keyCode==13 || evt.keyCode==0 || evt.type =='click')
            {
                key.focus();
                var keystr = encodeURIComponent(key.value);
                url = "http://www.google.com/search?q=";
                url = url+keystr;
                url += "&client=pub-7558339387099421&forid=1&ie=UTF-8&oe=UTF-8&safe=active&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A1&hl=zh-CN&x=0&y=0&domains="+site+"&sitesearch="+site;
                window.location=url;
                return false;
            }
        }
</script>
<table><tr><td>
<input style="WIDTH: 130px" type="text" name="q" id="q" onkeydown="return SearchGoogle(document.getElementById('q'),event,'http://www.cnblogs.com/hardrock/')">&nbsp;<input onclick="SearchGoogle(document.getElementById('q'),event,'http://www.cnblogs.com/hardrock/')" type="button" value="搜索" name="sa">
</td><td>
<script type="text/javascript"><!--
  google_ad_client = "pub-7558339387099421";
  google_ad_format = "350x30_sdo";
  google_link_target = 2;
  google_color_bg = "ffffff";
  google_color_link = "black";
  google_encoding = "UTF-8";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td></tr></table>