JavaScript won't have any effect on spam. Bots generally don't process JavaScript. That's why captcha's which make use of JavaScript are very effective at blocking bots.