obv the more expensive the better specs. though its not the camera that takes the photo, its the photographer. dont think its all about mega pixels etc. work out what you will be using your camera for and then choose one. if you dont know much about cameras i suggest you read up before diving in and buying a dslr
Depends on what you want to do with it.. Why do you want to buy a new camera - what do you intend to photograph with it ? (people, buildings, landscapes, ..) Are you interested in learning anything about photography (what's aperture, .. ?) or do you want to use a dslr like a point-and-shoot camera ? Don't forget that on a dslr camera the lens you put on it is as important (or even more important, and sometimes even more expensive) than the camera body itself. So your next question should be: what lens to buy with it ? Do you want a wide or a zoom lens ? D40 is older (less megapixels), only take it if you want to learn to work with a dslr. D80 is better but already a bit more difficult to use. D60 is probably best price/quality for what most people want to use.
Like I said - it depends on what you want to make pictures of and what quality you require. Lenses come in various sizes and costs.. you can buy a lens of $100 and you can buy one of $2500 and more.. A lens will have a name like '70-200 f2.8 IS'. The 70-200 means it can zoom from 70 to 200mm. The 200mm is nice if you want to zoom in on items far away (ie make pictures of the moon), .. 70mm is already wide. You buy this kind of lens if you want to shoot out in nature and zoom in on specific items. Another lens is ie an 18-55mm. 18mm is already wide angle, and around 50mm is usually used for makin portraits. So if you want to make pictures that include a lot (ie landscapes, streets, in-house, ..) you need the wideangle. The 50mm part of that lens is nice if you want to shoot portraits, .. The 'f2.8' number will tell how good the lens will do in low-light conditions. A lower number is better but makes the lens more expensive.. This means if you want to make pictures in a dark environment (clubs, or in churches at weddings) you can make pictures without having to use a flash, ..) The 'IS' part means Image Stabilisation. I believe the D40 doesn't have built in IS in the body, so your need to buy lenses that have it if you want it.. it means the lens has small sensors and motors that correct any movement of the camera while you make a picture. So you can make better pictures in dark light conditions. If you need it, it can be better to buy a D60/80 that have it in the body so you can buy cheaper lenses and still have the same functionality. But if you really don't know anything about photography, I really suggest you learn a lot first, before you buy a dslr. I think you will be much better off buying a 'bridge' camera like the Fuji Finepix s100fs..