Add search to your blog/website
In Google you can use special keywords to customize your search. The keyword "site" followed by a colon enables you to restrict your search to a specific site. In the example below I searched for the word "DevPartner" in my entire blog-website.
I found it very useful to search into a specific blog-archive or into a specific website. This and some JavaScript is all you need to build the search-capability into you own webpages [Update : I've added a KeyPressEvent on the inputBox]:
1 <html>
2 <head>
3 <title>Search Google</title>
4
5 <script type="text/javascript">
6 function SearchGoogleByEvent(event)
7 {
8 //keyCode for EnterKey = 13
9 if (event.keyCode == 13)
10 {
11 SearchGoogle();
12 }
13 }
14
15 function SearchGoogle()
16 {
17 var currentSearchString = document.getElementById('SearchString');
18 window.navigate('http://www.google.com/search?q='
19 + currentSearchString.value
20 + '+site%3Akinnie.blogspot.com');
21 }
22 </script>
23
24 </head>
25 <body>
26
27 <h1>Search My Blog</h1>
28
29 <input type="text" name="inputSearchString" id="SearchString"
30 OnKeyPress="SearchGoogleByEvent(event);">
31
32 <input type="button" value="Search My Site" OnClick="SearchGoogle();">
33
34 </body>
35 </html>
Another interesting Search Feature by Google is the "link" keyword. The query link:URL shows you pages that point to that specific URL.
Update : be careful if you want to add a "google-search" to your blog/website. Read blogpost of David Cumps for more details.
0 Comments:
Post a Comment
<< Home