We use the Lewis and Riesenfeld invariant method to obtain the exact Schr"odinger wave functions for a time-dependent harmonic oscillator with and without an inverse quadratic potential. As a particular case we also obtain the wave functions for the Caldirola-Kanai oscillator.