Solution of the time-dependent Schrödinger equation with a trajectory method and application to H+-H scattering