hi,
javascript is just another text based data stream as far as the system is concerned. it is only when the text is read by the browser parser, that it becomes a programming language.
bascialy you have the right idea.
so in your javascript link, set the type as text/javascript and set the source to you javascript generating php page.
hope that clears things up.
ross