Adding a call to drupal_add_js()
directly in hook_menu()
doesn't work; the call to drupal_add_js()
should be added on the code that is executed when Drupal is outputting a page. This means:
Within a form, Drupal 7 modules can use something similar to the following code, to add a JavaScript file to the currently output page.
$form['#attached']['js'] = array(
drupal_get_path('module', 'my2form') . '/abc.js',
);
As alternative, if you write the following line in the .info file of a module, the JavaScript file will be added to any page.
scripts[] = abc.js
The path needs to be relative to the directory containing the module; if the file is contained in a sub-directory of that directory, e.g. javascript, the line should be the following one.
scripts[] = javascript/abc.js
hook_menu()
implementations are invoked, Drupal is not necessarily outputting a page; that is why the OP doesn't see the JavaScript file added to the page. That apart, the task ofhook_menu()
is not adding JavaScript files to the page, but returning the definition of the menu callbacks the module implements.