shrinking charactor script help please...

so im toying around with animations,
and i want my First person capsule to shrink, i created an animation for that…
i want to play the animation when i press “q”.
and when i press “e” i want to go back to normal size…i only know basic java script
can someone help me please???
i dont know how to assign buttons to a function…

Have a look at this:

Here’s an example:

 function Update()
{
 if(Input.GetKeyDown("q"))
 {
  // Plays the animation
  animation.Play("Animation Name ");
 }
}