I haven't used that much Javascript in DNN. - But if you wish to add it into the Text/HTML module.
Click on Edit Text
Click on Source to view the html view
Enter the code
DO NOT CLICK BACK on the source button, now just click direct on update and it should store the code without the editor messing up the code
If you still have problems try this:
Just add a Text / HTML module to the page to hold the javascript code
Click on Edit text
At the top of the editor select Basic Text Box
At the bottom select Raw
Enter the Javascript
Do not click on any other views
Click on update
In the
Incorporating sIFR (Scalable Inman Flash Replacement) with DotNetNuke skins tutorial Javascript code is used (video 5) (there is an addendum note at the bottom of the page for DNN versions 4.3+ as the method has slightly changed in 4.3+)
The other option is to place javascript directly in a skin, you can see an example of this in the code here:
Simple Red LeafHope this gives you a starting point,