How to add javascript to drupal 7?
Well adding JavaScript can be done through drupal_add_js().

You can add the JavaScript code in your template.php file.


Create a cool.js file where you copy the JavaScript code
Put the file in your themes/MYTHEME/js folder
In your template.php file, create a  page preprocess function

function MYTHEME_preprocess_page(&amp;$vars) {
  drupal_add_js(drupal_get_path('theme', 'MYTHEME') . "/js/cool.js", array("preprocess" =&gt; True));    
}

Clear the cache
Load your page and check the page source code to see if cool.js is being loaded; use ctrl+f to see if the file is present there
If the effect is still not coming, then verify the IDs in the HTML are correct