A JavaScript event simulator