鼠标事件:
/* onclick单击 */
/* ondbclick双击 */
/* onmouseover */
/* div1.onclick=function(){
console.log('单击')
}
div1.ondbcolick=function(){
console.log('双击')
} */
表单事件:
// onsubmit事件
document.getElementsByTagName('form')[0].onsubmit=function(){
console.log(111)
if(document.getElementById('account'),vaule!=='1331231234'){
return false
}
return true
}
// oninput
const account =document.getElementById('account')
account.oninput=function(){
// console.log(account.value)
}
// onfocus获得焦点
account.onfocus=function(){
console.log(account.value)
}
// onblur失去焦点
account.onblur=function(){
console.log(account.value)
}
// onchange看内容是否改变,内容改变则触发
account.onchange=function(){
console.log(account.value)
}
窗口事件:
onresize=function(){//页面窗口改变触发
console.log(innerWidth)
}
onscroll=function(){//鼠标滚动触发
console.log(111)
}