Who's where?
Visitor [23] : Blog|Tutorials
Visitor [6] : Dotnetnuke templates
Twitter backgrounds gallery
background6
background10
background9
background8
background7
background4
background5
background3
background2
Support, Tutorials, Articles

Google custom search bar via JavaScript (instead of form tag).

   

Hi,

Google cutom search engine is a tool allowing you to tell google which site you would like it to index for you and it's letting you a code for a search bar to put it in your site.

This way, you are allowing your site visitors search with in your site's content , or within other sites you find interesting and relevanting to the content of your site. It's a kind of bookmarking site but you bookmark the content of the site and not only the link to it, into your search engine.

The code they give to embed is in most cases a "form tag" , which is not very user friendly to dotnetnuke portals, where you can not use a (nother) form tag in the document.

There are a few modules for dotnetnuke,  you can purchase, which will do the work.

one thing they won't do is let you embed the search bar any where you like, inside your blog template or other.

That's the code: 

<p id="custom_search"><input type="text" style="width: 175px;" value="" id="query_custom_search_input" /> <a href="#" onclick="querySearchEngine(document.getElementById('query_custom_search_input').value)">Search</a></p>
<script type="text/javascript">
function querySearchEngine(query){
query = query;
window.open("URL_OF_YOUR_CUSTOM_SEARCH_PAGE_RESULTS&ie=UTF-8&q=" +query);

}
</script>

(Look for the #custom_search class in the CSS) :)

Enjoy !

posted @ Sunday, April 26, 2009 3:17 AM by Avi A