Key to treating mildew is to halt its growth and suspend damage by immediately drying out the books. Fan the pages open and air them out, in the sunshine if possible. If not, put them in a dry room with good air circulation, perhaps with a heater or dehumidifier running to leach all moisture from the pages. If the pages are very wet, consider sprinkling talc or cornstarch between book pages to absorb wetness. Leave powder in place for several hours, then brush it away and continue to air out the pages.
Once the pages are completely dry, try brushing off any dry pieces of mold with a brush or a dry paper towel or cloth. Brush in one direction only, away from the spine of the book to reduce the number of spores that lodge between pages and regrow later. Do this outside and away from open windows if possible to keep spores from drifting indoors and perpetuating the problem.
Once as much mold as possible is brushed away, dampen a cloth in warm soapy water and try gently wiping the stain. Do not scrub. Follow with a wipe of clear water. If the stain lingers, try bleaching it. Use one part bleach to four parts warm water, dampen a cloth or paper towel -- not drenching -- and carefully wipe or dab the affected portions of the book. Bleach kills mold and lightens darker stains. Follow with a wipe of clear water. If the stain is small, an ink eraser might eliminate it. Dry thoroughly. Consider taking measures to prevent regrowth of mold and mildew.
Mildew and mold grow best in warm, moist, unclean conditions. Prevent mildew growth by changing these conditions. Remove the dirt that feeds mold by cleaning the rooms in which books are kept. Keep rooms aired out with fans and proper ventilation so moisture does not collect on surfaces. For a closed bookcase, consider employing a small electric light.
In the case of valuable books or unusual circumstances, consider chemical-based prevention. Hang a bag of chemical dehumidifier such as paradichlorobenzene or paraformaldehyde in a closed bookcase or coat books with a dusting of paraformaldehyde before sealing them. Paraformaldehyde is toxic and potentially irritating to those sensitive to it. Do not inhale fumes. Other preventative solutions include applying a light fungicide spray or wiping books with a cloth dampened in a solution of 3/8 ounce salicylanilide and one quart rubbing alcohol. Unless books are sealed, however, they will need to be retreated occasionally.