0
只是在这里为jQuery选择器的一点帮助..问题是当我点击(“.x”),(“.bigCon”)也会触发..我只是希望只有( “.bigcon ”)将拥有的onclick则警告(“ 黑”)......很抱歉有点混乱事件..:djquery选择器:父问题
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script>
$(document).ready(function(){
$(".x").click(function(){
$(".evClick").removeClass("evClick").addClass("sample");
$(this).addClass("evClick");
}).mouseover(function(){
$(this).toggleClass("evHover");
}).mouseout(function(){
$(this).toggleClass("evHover");
});
$(".bigCon").click(function(){
alert("black");
});
});
</script>
<style>
.x {
width:100px;
height:100px;
margin:10px;
}
.bigCon {
background:black;
width:240px;
height:540px;
}
.sample {background:red;}
.evHover {background:green;}
.evClick {background:yellow;}
</style>
</head>
<body>
<div class="bigCon">
<div class="sample x"></div>
<div class="sample x"></div>
<div class="sample x"></div>
<div class="sample x"></div>
<div class="sample x"></div>
</div>
</body>
</html>
谢谢先生.. – 2010-12-20 07:24:54