Magnetic properties and molecular quadrupole moment of HF and HCl by molecular-beam electric-resonance spectroscopy