<button id="but">click</button>
<script>
var but = document.getElementById('but')
but.addEventListener('mousedown', function () {
var data = new Date();
but.addEventListener('mouseup', function fn () {
if(new Date() - data > 3000) alert(2)
but.removeEventListener('mouseup', fn, false)
},false)
},false)
</script>