<script>\n var garbage = document.body.text; // throw the text from the body into a variable\n function addGarbage(){\n document.body.text.add('foo'); // write some additional text into the body\n garbage += document.body.text; // append the current body contents to your variable\n addGarbage();\n }\n</script>\n<body onLoad="addGarbage()" onUnload="document.new(garbage)">
Basically call a recursive function that keeps appending more and more crap to the body, and if you try to close the browser it opens a new window to keep writing crap. You probably wouldn't even need to add more to the body, just keep filling the variable with ever-increasing junk.
Seems pretty easy to do. I wonder how different browsers would deal with it, and if it would be more than an annoyance.
This is what happens when people who don't write childishly destructive code for a living see some childishly destructive code.