events事件
鼠标事件:click、mouseup、mousedown、mousemove、mouseout
键盘事件:keyup、keydown
UI:focus(聚焦)、blur(失焦)
注意:事件前面加on
—————————————————————————————————————————
click(点击):
var oapp=document.querySelector("#app");
document.onclick=function(){
alert("hello world");
}
mousemove(鼠标移动):
var oapp=document.querySelector("#app");
document.onmousemove=function(){
console.log("hello world");
}
mouseup(鼠标抬起):
var oapp=document.querySelector("#app");
document.onmouseup=function(){
console.log("hello world");
}
mousedown(鼠标放下):
var oapp=document.querySelector("#app");
document.onmousedown=function(){
console.log("hello world");
}
mouseout(鼠标移动到边界):
var oapp=document.querySelector("#app");
document.onmouseout=function(){
console.log("hello world");
}
keyup(键盘抬起):
var oapp=document.querySelector("#app");
document.onkeyup=function(){
console.log("hello world");
}
keydown(键盘放下):
var oapp=document.querySelector("#app");
document.onkeydown=function(){
console.log("hello world");
}