Since JavaScript happens on the clientside, can be turned off, is not interpreted by robots/spiders and so on, there's really not much you can do on the client alone.
What kind of security do you need? Any prevention of malicious code being injected should of course all happen on the server, but I'm guessing you want to stop spambots?
Here's a couple of tips on how to prevent bots without using measueres visible to the visitor:
Ned Batchelder: Stopping spambots with hashes and honeypots
They do require some serverside code, but there's not really a good way around that.
If nothing but clientside code is out of the question, I'd leave the action-part of the form tag empty (or rather fill it with an invalid url), then use JavaScript to fill it in when the page has loaded. That way no bot will ever be able to submit that actual form, as they don't parse JavaScript.
But of course it won't for humans who've turned of JavaScript either, and any spammer who takes the time to dig out the URL from the script can easily submit POST data directly to it.