Google couldn't do that reliably until, hmm, two years ago, ish? (GoogleBot still doesn't execute all Javascript, but it is getting smarter about both heuristic evaluation and limited execution. Test if you're skeptical, for example, by linking to pages "obviously" from within Javascript, linking to them using something a wee bit tricky like Prototype -> AJAX load a static file with the link in it, and then try with something where you need full execution to evaluate the link URL. Then see which pages Googlebot visits. For best results do this from a well-loved page.)
That would (to some degree) open them up to DoS attacks.
E.g. place a bunch of hidden links on your site that spiders will follow and have them do long JavaScript computation — perhaps these computations could actually do useful stuff :)