We study the control of dissociation of the hydrogen molecular ion to attosecond and infrared laser pulses by solving the time-dependent Schrodinger equation. While the first ultraviolet pulse is used to excite the electron wave packet on the dissociative state, a second time-delayed infrared pulse steers the electron between the nuclei. Our results show that by adjusting the time delay between the pulses and the carrier-envelope phase of the near-infrared pulse, a high degree of control over the electron localization on one of the dissociating nuclei can be achieved. The results demonstrate that current (sub-)femtosecond technology can provide a control over both electron excitation and localization in the fragmentation of molecules.