how to set and unset javascript files for specifc path aliases in Drupal 7? I am trying to set particular javascript files for a specific node page by getting the path alias. like this:

$path=drupal_get_path_alias();  
if($path == 'about-us')
  drupal_add_js(drupal_get_path('theme', 'mytheme') . "/page-download.js");


which it doesnt work. 
But when i add the particular javascript file to my .info file it works. 
Also in other pages i will have to unset some of the javascript files if the above does not work but still unsetting javascripts does not work. 

unset($vars['js']['all']['page-download.js']);
As far as adding the JS file goes it probably depends where you're calling that code from. If you're calling it directly in a template file it's probably happening too late in the page build.

A hook_preprocess_page() implementation would probably be a good place for it (as would hook_init() and probably a bunch of others). You can also use request_uri() to check the current path without incurring a lookup for the alias.

function MYMOUDLE_preprocess_page(&amp;$vars) {  
  if (request_uri() == '/about-us') {
    drupal_add_js(drupal_get_path('theme', 'mytheme') . "/page-download.js");
  }
}


If for whatever reason you can't get that to work, you can remove a JS file by implementing hook_js_alter():

function MYMODULE_js_alter(&amp;$js) {
  if ($some_condition) {
    $js_path = drupal_get_path('theme', 'mytheme') . "/page-download.js";
    if (isset($js[$js_path])) {
      unset($js[$js_path]);
    }
  }
}