Implementing bookmarklets in JavaScript.

Handy tutorial.