The viscoelastic properties of materials confined to molecularly thin films were investigated by molecular simulations of oscillatory shear flow and continuum mechanics. The simple liquid's atoms were found to interact through a repulsive Lennard-Jones potential. A linear viscoelastic behavior was exhibited by the simple and polymeric fluids under typical simulation conditions. A smooth transition from liquidlike to solidlike behavior was displayed by simple fluids when confined to molecularly thin films. Linear chain polymers and gels displayed elastic shear response at all frequencies investigated.