Geeks With Blogs
Chris Breisch   .NET Data Practices
Search this Blog!

I was trying to tweak my blog a bit yesterday, so I did some research on "Custom CSS Selectors".  I didn't figure out how to do what I wanted to do (still researching), but I did figure out how to do a number of different things.

A lot of the info I used, I got from this post by Josh Ledgard.

I had to modify his directions a bit to add search to my blog, but it's pretty close.  I changed my subtitle to the following:

.NET Data Practices<div id="s">Blog Search<br><input class="BS" type="text" name="SB" id="bstm" onkeypress="return bsm(event, this);"> <input type="button" value="Search!" onclick="return bsm2('bstm');" class="bsb"></div>

Then I added the following to the Static News/Announcment area:

<script type="text/javascript">
function bsm(event, oInput) {
var keyCode = (event) ? event.keyCode : keyStroke.which;
if (keyCode == 13) {
top.location = '
http://search.msn.com/advresults.aspx?q=' + escape(oInput.value) + '%20cbreisch&FORM=SMCA&adv_f=all&adv_dom=geekswithblogs.net&adv_depth';
return false;
} return true;
}
function bsm2(oInputId) {
var oInput = document.getElementById(oInputId);
top.location = '
http://search.msn.com/advresults.aspx?q=' + escape(oInput.value) + '%20cbreisch&FORM=SMCA&adv_f=all&adv_dom=geekswithblogs.net&adv_depth';
return false;
}
</script>

This all works with a .Text blog, but you'd have to do something different if your blog server doesn't use .Text.  But to customize for yourself, in the above, change geekswithblogs.net to whatever your site is and cbreisch to whatever the name of your blog.  I use MSN search, and I got the updated directions from this post from David Cumps. I didn't use Google for two reasons: 1) Google requires you put their logo next to your search, and 2) I don't use Google.

I've made quite a few other changes based on Josh's stuff, but they're still a work in progress.  When I get them completed, I'll blog about what I did there as well.

 UPDATE:  I forgot to mention the styles for the button that I added to the Custom CSS Selectors:

.bs
{
hieght: 20px;
width: 140px;
font-size: 0.9em;
}
.bsb
{
font-size: 0.9em;
}

#s{
position : absolute;
right : 10px ;
top : 10px;
font-weight: bold;
color: white;
}

Posted on Thursday, October 26, 2006 10:03 AM General | Back to top


Comments on this post: I've Added Search to My Blog

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Chris J. Breisch | Powered by: GeeksWithBlogs.net