您的位置:首页 > 编程语言 > Go语言

使用Google做自己的站内搜索

2011-07-08 00:00 423 查看
做网站,站内搜索是一个必不可少的功能。但是自己做搜索,如果要做好不容易,做得不完善又会加大服务器资源的开销,一个比较好的方法是借助Google做自己的站内搜索。有现成的强大的搜索在,自己也可以偷懒些。下面是对nowamagic.net的一个简单的站内搜索。








<form action="http://www.google.com/search" method="get" target="_blank">
					<input name="q" id="search" alt="Search" class="inputbox" type="text" size="20" value="要搜东西?"  onblur="if(this.value=='') this.value='要搜东西?';" onfocus="if(this.value=='要搜东西?') this.value='';" />
					<input name="sitesearch" value="www.nowamagic.net" type="hidden" />
					<input type="submit" name="btnG" value="Google 搜索">
    					<!-- <input type="submit" value="查询" /> -->
				</form>


下面的搜索则可以搜全网,也可以站内,默认是站内。













搜互联网
站内搜索




<form method=get action="http://www.google.com/search" target="_blank">
	<table bgcolor="#FFFFFF">
		<tr>
			<td><a href="http://www.google.com/"> <img src="http://www.google.com/logos/Logo_40wht.gif" 
border="0" alt="Google"></a></td>
			<td>
				<input type="text" name="q">
				<input type="hidden" name="hl" value="zh-CN">
				<input type="submit" name="btnG" value="Google 搜索">
				<input type="hidden" name="domains" value="www.nowamagic.net">
				<br />
				<input type="radio" name="sitesearch" value="">搜互联网
				<input type="radio" name="sitesearch" value="www.nowamagic.net" checked>站内搜索
			</td>
		</tr>
	</table>
</form>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: