以下是 Google 站內查詢 JavaScript
<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 = "<a href="http://www.google.com/search?q">http://www.google.com/search?q</a>="; url = url+keystr; url += "&ie=UTF-8&oe=BIG5&hl=zh-TW&domains="+site+"&sitesearch="+site; window.location=url; return false; } } </script>
以下是 html
<input type="text" name="q"> <input type="button" value="Search" onclick="SearchGoogle(document.getElementById('q'),event,'blog.toright.com')">
使用前提:
必須先讓google建立網站的Index喔~~
建立方法可以參考 Google Sitemap