<!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>