A novel scheme to suppress both stimulated Brillouin scattering (SBS) and stimulated Raman scattering (SRS) by combining an alternately changing frequency laser and a transverse magnetic field is proposed. The alternating frequency (AF) laser allows the laser frequency to change discretely and alternately over time. The suppression of SBS is significant as long as the AF difference is greater than the linear growth rate of SBS or the alternating time of laser frequency is less than the linear growth time of SBS. However, the AF laser is ineffective to suppress SRS that usually has a much higher linear growth rate than SBS. To remedy that, a transverse magnetic field is also joined to suppress the SRS instability. The electrons trapped in the electron plasma waves (EPWs) of SRS can be accelerated by the surfatron mechanism in a transverse magnetic field and eventually detrapped. While continuously extracting energy from EPWs, the EPWs are dissipated and the kinetic inflation of SRS is also suppressed. The one-dimensional particle-in-cell simulation results show that both SBS and SRS can be effectively suppressed by combining the AF laser and a transverse magnetic field with tens of tesla, and the total reflectivity can be dramatically reduced by more than one order of magnitude. These results provide a potential reference value for controlling SBS and SRS under the related parameters of inertial confinement fusion.