This paper addresses the output consensus problem for heterogeneous multi-agent systems (HMAS) with Denial-of-Service (DoS) attacks under stochastic switching topologies. The stochastic switching communication network among agents is modeled as a time-varying directed graph governed by Bernoulli process. Taking into account the weight of the historical triggering data and corresponding triggering error, a novel dynamic memory event-triggered mechanism (DMETM) is proposed and it can reduce the number of event-triggered to realize significant communication savings. Consider the impact of DoS attacks, a distributed local full-state feedback controller is designed to ensure that the output state of the followers can track the leader. Rely on the Lyapunov theory, it is certificated that output consensus for HMAS can be guaranteed. Finally, the effectiveness and progressiveness of the proposed control scheme are verified by a simulation example.