This is freakingly awesome idea!
It surely will help to
better distribute the overall hashing power, thus making the bitcoin network even more resilient.
I'm not sure the client will be very happy to see his computer burning CPU for no apparent reason, though.

But indeed it is probably better than annoying ads. Again: awesome idea.
Not quite...
Google could place this on their website and gain 50%+ hashing power of the network overnight.
EDIT: Then again, maybe not...
According to my calculations....
One $100 5830 can do 300,000,000 hashes per second if tweaked correctly.
Divided by an average of 10,000 hashes per second for an average cpu running this javascript miner = 30,000 concurrent visitors to your website to equal the hashing power of a 5830 - and whenever users hit your website, their CPUs would start burning up... so they would probably leave within let's say 2 minutes of visiting your web page.
So multiply 30,000 concurrent required visitors by the number of 2 minute intervals in the day... (24 * 60 / 2 = 720)
And you come to a total of
21,600,000 unique visitors per day that you would need to your website in order to hash the equivalent of a
$100 GPU.
Or make about $8 per day according to the bitcoin calculator right now from 21 million unique visitors.... totally not worth it.
Phew, now I feel better about my mining investments!
Don't get me wrong OP, I love it when
anybody contributes
anything to the bitcoin network, I am just thinking out loud.