javascript
How to calculate distance with javascript and Google Maps API
Brian Cray does a fantastic job of explaining how to use the Google Maps API to calculate the distance between two address.
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.
Add JavaScript From a Module
The following bit of code will add your javascript file to the page.
// get the path to the module
$mod_path = drupal_get_path('module', 'YOUR_MODULES_NAME');
// add the functions.js file where all the javascript will be located
drupal_add_js($mod_path .'/functions.js');Include the required Google file for mapping