<!DOCTYPE html>
<html>
<head>
<title>11.html</title>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
</head>
<script type="text/javascript">
$(function(){
$("[type=button]").bind("click",function(){
alert("hehe开车");
});
$("li").bind({
mouseover:function(){
$(this).css("background","pink");
},
mouseout:function(){
$(this).css("background","");
}
});
});
//卸载事件
// $("li").unbind("mouseover mouseout");
</script>
<body>
<div>
<ul type="button" >
<li>fth</li>
<li>aaa</li>
<li>qq</li>
<li>ww</li>
</ul>
</div>
</body>
</html>
JavaScript点击事件加卸载事件完美版!
最新推荐文章于 2022-08-22 14:33:46 发布