zoukankan
html css js c++ java
在博客页首添加搜索功能
把博客园的搜索设置移植到了页面顶端,这样让博客的搜索功能更加醒目。
同时整合了“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/')"
>
<
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
>
查看全文
相关阅读:
uva-11361
HDU
LCS
CodeForces
linux 有趣的命令组合
opencv识别封闭区域 并标记该区域
宜出行人口热力图
美团酒店
赶集租房
发送企业微信应用通知
原文地址:https://www.cnblogs.com/hardrock/p/1054281.html
最新文章
P1179 数字统计
使用getline的注意事项
如何判断闰年
java通过代码连接的时候出现Could not create connection to database server. Attempted reconnect 3 times. Giving up.
elipse环境变量配置
如何安装mysql以及建立连接
如何安装elipse以及配置环境
P3717 [AHOI2017初中组]cover
P3150 pb的游戏(1)
P2956 [USACO09OCT]The Robot Plow G
热门文章
单链表
顺序表
eclipse 快捷键
算法第四版 1.2.1
uva-11468
hdu-2222
线段树板子(刘汝佳)
hdu-1556
uva-11077
uva-11732
Copyright © 2011-2022 走看看