heh... this is funny because I never really stopped to think about how complicated this is, but it really is.
Ok...
Lenses are broken up into two major focus categories... auto-focus (AF) and manual focus (MF) (or, really... "with the absence of autofocus"

). AF lenses will, as is implied, do the focusing for you.
In the AF category, there are two sub-categories... lenses that have a AF drive screw and are thus focused by the camera actually moving a little screw to adjust the focus... and lenses that have an AF motor built directly into the lens, such as HSM lenses.
Cameras like the D40 and D60 require the latter type of the autofocus lenses because they have no autofocus drive screw.
--- Only those who are not feint of heart should read further than this point ---
Note that there are yet two more subcategory of AF lenses... and these overlap, so they are not mutually exclusive from the above AF subcategories.
The first are AF lenses that allow small manual adjustments after the autofocusing takes place. This is a VERY nice feature and I don't believe that many lenses have this.
(POSSIBLE MISINFORMATION ALERT!) The second are AF lenses that also allow manual focus. I'm not 100% sure on this one, but I do believe that there are AF lenses that do not allow manual focus at all. I'm actually expecting to be wrong on this one, so take it with a grain of salt.

(enough disclaimers for you?)