Drupal 6: Adding CSS and Javascript from a module

Here’s how you can include javascript and/or css from a module. If you’d like to include the files on every page load, you can put this code snippet in your hook_init().

function MYMODULE_init() {
  // add module javascript
  drupal_add_js(drupal_get_path('module','MYMODULE') . '/MYMODULE.js');

  // add module css
  drupal_add_css(drupal_get_path('module','MYMODULE') . '/MYMODULE.css');