Sorry, I wasn't very clear in my first post. You will have to manually create an aspx page or a ascx webpart and place it on a page. This control or page would then be stored in the physical file system. Then in your page type on the General tab, towards the bottom there are some properties for the page type (Editing pages settings), you need to set the URL there. So with this option, you are physically creating code.
Again, I'll ask, what is the javascript for or what are you trying to accomplish? There may be an alternative without writing any code.