Get Google Ajax Search For Your Site UPDATE
If you read my recent post, How to Get Google AJAX Search For Your Site, and used it to implement the Google Ajax Search control on your blog or website, this post is for you.
When I replaced the old Google Search box with the newer Google Ajax Search for my blog, I quickly realized that there was no way to clear the search results from the screen. That's why I wrote the function "searchControlClear()" that I described previously. Since writing that post, Google has included the clear functionality natively into the search control, so some changes could be made to make things work more smoothly.
These are the changes I made to use Google's built in function instead of my own. In your javascript, you need to make two changes: one at the beginning and one at the end. First, move this line of code:
When I replaced the old Google Search box with the newer Google Ajax Search for my blog, I quickly realized that there was no way to clear the search results from the screen. That's why I wrote the function "searchControlClear()" that I described previously. Since writing that post, Google has included the clear functionality natively into the search control, so some changes could be made to make things work more smoothly.
These are the changes I made to use Google's built in function instead of my own. In your javascript, you need to make two changes: one at the beginning and one at the end. First, move this line of code:
var searchControl = new GSearchControl();
to the line above this line of code:So the beginning of your javascript should look like this:function onLoad()
The second change you need to make is at the end of your javascript code. Inside the searchControlClear() function, replace everything with this://<![CDATA[
var searchControl = new GSearchControl();
function onLoad()
{
function MyBlogSearch()
{
.
.
.
So your function should look like this:searchControl.clearAllResults();
Try this on for size!function searchControlClear()
{
searchControl.clearAllResults();
}
Labels: google