function triggerMouseEvent (node, eventType) { var clickEvent = document.createEvent('MouseEvents'); clickEvent.initEvent (eventType, true, true); node.dispatchEvent (clickEvent); } var srcListenButton = document.getElementById('gt-res-listen'); triggerMouseEvent (srcListenButton, 'mouseover'); triggerMouseEvent (srcListenButton, 'mousedown'); triggerMouseEvent (srcListenButton, 'mouseup');