Javascript: Select text on a page and search in google
There are a few demonstrations out there of how to invoke a search on the current text selection.
This is a stab at doing it in a non-intrusive way.
There are a few demonstrations out there of how to invoke a search on the current text selection.
This is a stab at doing it in a non-intrusive way.
June 17th, 2003 at 6:07 pm
That is a really great little code snippet. Probably one of the most useful I’ve used! I wrapped it up in a .js file and included it.
One question I have is that on my site for some reason in Mozilla Browsers the little G is locked into the upper left hand corner and I can’t seem to unlock it.
June 17th, 2003 at 7:19 pm
Thanks for creating the .js. The custom formatting looks nice too. The positioning issue has something to do with the loose.dtd in your DOCTYPE:
< !DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”"http://www.w3.org/TR/html4/loose.dtd”>
Switch the doctype to:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
and watch the problem disappear

I have to plead ignorance about exactly why the doctype causes the absolute positioning to not work. But switching doctypes shouldn’t cost you anything–the page doesn’t validate anyway
June 18th, 2003 at 10:01 am
firebird has this standard under the right mouse button
June 18th, 2003 at 10:22 am
Hey, you’re right!
It took me a few minutes to figure out your comment. For anyone who’s still scratching their head–in Firebird, if you select some text and then right-click on the selection, one of the menu options is “Web search for ‘ABC’” where ABC is your selection.
Dang, all that work for nothing
June 18th, 2003 at 3:31 pm
LOL! You would tell me to change my DOCTYPE..
I lust added the loose.dtd to get the darned thing to validate!
Even if Firebird does have this option, IE doesn’t, not to mention the pure “cool factor!”
Thanks again.
Did you grab the .js??