Here is a slightly updated version of the code from my previous post. The alert box that appears will also display the title and url for the current page. Try the bookmarklet on different pages and you will see it has access to the current document.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
   <title>Hello World</title>
   <a href="javascript:{alert('Hello World!\n\nFrom ' +     
      document.title + ' @ ' + document.location.href);}">
      Hello World!</a>