you need to add javascript to the header, i.e.
var head = document.getElementsByTagName("head")[0];
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = 'http://www.somedomain.com/somescript.js';
head.appendChild(newScript);
(this is a pretty common thing, but I copied the code here: http://www.hunlock.com/blogs/Howto_Dynamically_Insert_Javascript_And_CSS )
:
jQuery, :
<script>
[....]
$( "head" ).append( "<script src='myScript.js'></script>" );
[....]
</script>
, , javascript </script> .