Switches actuated by change of magnetic field or of electric field