Spatiotemporally localized injection of electrons is a key element for development of plasma-wave electron accelerator. Here we report the demonstration of two different schemes for electron injection in a self-modulated laser wakefield accelerator (SM-LWFA) by using a laser pulse. In the first scheme, by implementing a copropagating laser pulse with proper timing, we are able to control the growth of Raman forward scattering (RFS) and the prepulse also plays the role of injecting hot electrons into the fast plasma wave driven by the pump pulse. In the second scheme, by using a transient density ramp we achieve self-injection of electrons in a SM-LWFA with spatial localization. The transient density ramp is produced by a prepulse propagating transversely to drill a density depression channel via ionization and expansion.