I'm trying to create my own bookmarklet, and there aren't exactly a huge number of guides for doing so. Basically, right now I'm trying to figure out why I can't just do javascript:document.write("HAI, WORLD"), which has the unintended effect of replacing the window contents.
It's my understanding from elsewhere that Javascript replaces the entire contents of the window with the return value of a method, so I've also tried javascript:void(document.write("wut")), but the entire window contents are still replaced.