I don't think javascript is allowed in order to prevent people from abusing the right to post HTML and cause damage to your site or people browsing it.
You might be able to create some custom BBCode or something, I think that allows you to use Javascript. Otherwise you will need to include your Javascript in a template and post the rest of the HTML in the post.