鼠標(biāo)事件1、單擊事件 onclick
2、雙擊事件 ondblclick
3、按下 onmousedown
4、松開 onmouseup
5、滑到 onmousemove
6、移入 onmouseenter onmouseover
7、移出 onmouseleave onmouseout
8、右鍵
div.oncontextmenu=function(e){
e=e||window.event
e.preventDefault()
console.log('123456')
}
鍵盤事件1、鍵盤按下某鍵 keydown
2、鍵盤松開某鍵 keyup
3、按下并松開某鍵觸發(fā)的事件 keypress
表單事件1、失焦事件 onblur
2、聚焦事件 onfocus
3、內(nèi)容被改變時(shí) change
4、內(nèi)容被選中時(shí) select
5、按鈕事件 submit(提交) reset(重置)需作用在表單之中
<script>
var body = document.getElementsByTagName('body')[0]
body.onkeydown=function(e){
e=e||window.event
console.log(e)
}
body.onkeyup=function(w){
w=event||window.event
console.log(w)
}
</script>
其他事件1、加載之后運(yùn)行文件
2、窗口大小發(fā)生改變時(shí)觸發(fā)的事件
3、瀏覽器頁面滾動(dòng)時(shí)觸發(fā)的事件