Homepage » My Releases, Web Development » Text Selection Google Search

Text Selection Google Search

By Jonathan + July 5th, 2005

Those bookmarklets got me thinking, it would be pretty handy to be able to quickly Google any word on a website (especially one with as many technical terms as this one).  I wrote a javascript that works like so:

  1. the user selects (click-drag) a piece of text (must be inside a paragraph, without HTML, and less than 20 characters)
  2. the selection turns into a "highlighted" link
  3. if the user clicks the link, they are taken to the Google search results for that term

Try it on these words: Ajax DHTML Keebler 

You can download the script here

If you want it to look pretty, you’ll need to add this style to your page too:

<style>
.HighlightedText
{
background: lightyellow;
border-bottom: 1px red dashed;
cursor: hand;
cursor: pointer;
}
.Definition
{
color: red;
text-decoration: underline;
font-size: smaller;
}
</style>

Have fun and make sure to leave comments :D

2 Comments at "Text Selection Google Search"

MrHappy July 5th, 2005 (#)

Doesn’t appear to work in Safari or IE for Mac. You should get a Mac….

dan October 23rd, 2006 (#)

awesome script. im using it on my blog

Have you thought about adding the google adsense key to it somehow so that when people click on a word in your blog, and search, you get paid? :)

Comment Now!

Name* Email* Blog / Website

Latest Posts

Fixing Connect360 on the New Xbox Experience November 19th, 2008

Fixing Connect360 on the New Xbox Experience

When I fired up the New Xbox Experience tonight, the first thing I checked was whether Connect360 worked. I think I would probably use my Xbox for a[...] Read the rest »