mousedown监听onmousemove判断鼠标指针移动方向的JavaScript

<script>
document.getElementById("inputid").addEventListener('mousedown', function(event) {
  event.preventDefault()
  var onceweb
  window.onmousemove=function(e){
  e.preventDefault()
  console.log(e)
  if(dis - e.clientY > 0){
    console.log("向上")
    document.getElementById("inputid").value++
  }else{
    console.log("向下")
    document.getElementById("inputid").value--
  }
  onceweb = e.clientY
  }
  window.onmouseup=function(e){
    window.onmousemove=null
  }
});
</script>

上一篇:CSCI1540 Fundamental Computing


下一篇:词根(1)