Many cats nip and bite when they’re happy, particularly if they have a low threshold for stimulation. You can learn the warning signs of when your cat’s becoming overstimulated: you might feel his muscles tense or see his tail twitch or his rear end waggle. If you can tell he’s about to bite, stop patting him until his calmed down.
If your cat is stalking your feet, he’s engaging in what is called predatory-play behavior. He has a natural instinct to attack moving objects in the wild. Indoors, your feet are the only moving prey he has to ambush. To prevent this behavior you can give him plenty of non-human moving targets to play with by trailing a string across the floor, waving feather toys, or giving him balls to bat around.
Discouraging his attacks is another way to help prevent the attack. Safe and effective ways to do this are spraying him with a water bottle or using a small can of compressed air to make a loud hissing sound. If you are vigilant and discourage the attacks consistently, you’ll take a big step toward changing your cat’s behavior.
The information above was gathered from a wonderful site on pet health. http://www.healthypet.com/