drupal_add_js()
Load external js file in Drupal 6
I found this little snippet today and what a help it is. Put this in your template.php file and you can load JavaScript files from an external source.
$external_js = 'http://www.example.com/a.js';
drupal_add_js('document.write(unescape("%3Cscript src=\''.
$external_js .
'\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline');*Note: I formated the above to display correctly on this page.
Make Your PHP Variables Available to JavaScript
For my Visitor Info module I needed to pull some info out of the database and make that info available to JavaScript. Following is the code I used to do just that.