<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
div
{
width: 200px;
height: 200px;
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
//如果觸發了某元素的某個事件,則也會觸發此元素所在的父容器(祖父容器......)的同類型的事件,不會觸發別的類型的事件
// $('#Button1').click(function () {
// alert('你點擊了按鈕');
// })
// $('div').mouseenter(function () {
// alert('你點擊了層');
// })
// $('body').click(function () {
// alert('你點擊了我的body');
// })
/*$('#Button1').bind('click', function () {
alert('你點擊了按鈕');
})
$('#Button1').bind('mouseenter', function () {
alert('不要過來,趕緊走開');
})*/
$('#Button1').bind({ 'click': function () { alert('你點擊了按鈕'); }, 'mouseenter': function () { alert('不要過來,趕緊走開'); } })//鼠標點擊按鈕會觸發兩次mouseenter事件---存疑
})
</script>
</head>
<body>
<div>
<input id="Button1" type="button" value="button" /></div>
</body>
</html>