Here are some common DOM events
1 Mouser Events
click dbclick mouseenter mouseleave
2 Keyborars Events
keypress keydown keyup
3 Form Events
submit change focus blus
4 Docment/Wiindow Events
laod resize scroll unload
click()
the function is executed when the user clicks on the html element.
eg:
$("p").click(function(){
$(this).hide();
})
dblclick()
the dblclick() method attaches an event handlerfunction to an html element. the function is executed when the user double-clicks on the html element
eg:
$("p").dblclick(function(){
$(this).hide();
})
mouseenter()
the function is executed when the mouse pointer the html element
eg:
$("p").mouseenter(function(){
alert("you entered p");
})
mouseleave()
the function is executed when the mouse pointer leaves the html element
eg:
$("#p").mouseleave(function(){
alert("bye! you now leave p");
})
mousedown()
the function is executed , when the left,middle or right button is pressed down, while the mouse is over the html element
eg:
$("p").mousedown(function(){
alert("mouse down over p");
})
mouseup()
the function is excuted, when the left.midddle or right mouse button is released while the nouse is over the html element
eg:
$("p").mouseup(function(){
alert("mouse up over p");
})
hover()
the hover() method takes two functions and is a combination of the mouseenter() and mouseleave() methods
the first function is executed when the mouse enters enters the html element, and the second function is executed when the mouse leaves the html element
eg:
$("p").hover(function(){
alert("you entered p");
},funtion(){
alert("bye! you now leave p");
})
focus()
the focus() methods attaches an event handler function to an html form the function is executed when the form field gets focus
eg:
$("input").focus(function(){
$(this).css('background-color','#cccccc');
});
blur()
the blur() method attaches an eveent handler function to an html
the function is executed when the form field loses focus
$("input").blur(function(){
$(this).css('background-color','#ffffff');
})
on()
the function attaches one or more event handlers for selected selected
elements
eg:
$("p").on("click",function(){
$(this).hide();
})
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。