I don't know what you mean by "mixing". The extension has to be .php (or a variant of that, like .php3 or 4 or 5 or something -- not sure of the options, on Bravenet), or else you have to play games with .htaccess, which is probably not advisable.
But .php files are executed on the server, and JavaScript is executed on a web browser, so I don't think what you are trying to do would work. I think there's probably a way of doing it, or something similar, if you check out the reference I posted above.