<script type="text/javascript">
$(document).ready(function () {
$(".leftdiv").click(function () {
$(".leftdiv").css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_inactive.png)" });
$(".leftdiv2").css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_inactive.png)" });
$(".leftdiv2 > p").css({ color: "#666666" });
$(this).css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_active.png)" });
$(this + "div").css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_active.png)" });
$(this > "p").css({ color: "White" });
});
});
</script>
<div class="leftdiv" style="height:60px; color:White; background-image:url(images/designer_leftbutton_active.png);">
<p style="font-size:14px; color:White; ">1. MODEL</p>
<p style="font-size:10px; color:White; margin-top:-13px;">Ments,Normal fit,Long</p>
<p style="font-size:10px; color:White; margin-top:-13px;">seleve</p>
</div><div class="leftdiv2" style="background-image:url(images/designer_leftbutton_active.png);"></div>
<div class="leftdiv">
<p style="font-size:14px; ">1. FABRIC</p>
<p style="font-size:10px; margin-top:-13px;">Elbrus,white</p>
</div><div class="leftdiv2"></div>
<div class="leftdiv">
<p style="font-size:14px; ">1. COLLAR</p>
<p style="font-size:10px; margin-top:-13px;">Business</p>
</div><div class="leftdiv2"></div>
<div class="leftdiv" style="height:60px;">
<p style="font-size:14px;">1. CUFF</p>
<p style="font-size:10px; margin-top:-13px;">Single,button,Beveled,</p>
<p style="font-size:10px;margin-top:-13px;">Small slevet button</p>
</div><div class="leftdiv2"></div>
在javaScript用‘this’关键字做为层筛选器的参数的时候(红色部分),为什么获取不到??哪里有问题??
$(document).ready(function () {
$(".leftdiv").click(function () {
$(".leftdiv").css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_inactive.png)" });
$(".leftdiv2").css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_inactive.png)" });
$(".leftdiv2 > p").css({ color: "#666666" });
$(this).css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_active.png)" });
$(this + "div").css({ "background-image": "url(http://localhost:1662/WebSite/images/designer_leftbutton_active.png)" });
$(this > "p").css({ color: "White" });
});
});
</script>
<div class="leftdiv" style="height:60px; color:White; background-image:url(images/designer_leftbutton_active.png);">
<p style="font-size:14px; color:White; ">1. MODEL</p>
<p style="font-size:10px; color:White; margin-top:-13px;">Ments,Normal fit,Long</p>
<p style="font-size:10px; color:White; margin-top:-13px;">seleve</p>
</div><div class="leftdiv2" style="background-image:url(images/designer_leftbutton_active.png);"></div>
<div class="leftdiv">
<p style="font-size:14px; ">1. FABRIC</p>
<p style="font-size:10px; margin-top:-13px;">Elbrus,white</p>
</div><div class="leftdiv2"></div>
<div class="leftdiv">
<p style="font-size:14px; ">1. COLLAR</p>
<p style="font-size:10px; margin-top:-13px;">Business</p>
</div><div class="leftdiv2"></div>
<div class="leftdiv" style="height:60px;">
<p style="font-size:14px;">1. CUFF</p>
<p style="font-size:10px; margin-top:-13px;">Single,button,Beveled,</p>
<p style="font-size:10px;margin-top:-13px;">Small slevet button</p>
</div><div class="leftdiv2"></div>
在javaScript用‘this’关键字做为层筛选器的参数的时候(红色部分),为什么获取不到??哪里有问题??
//如果是需要所有后辈div的hua
$(this).find("div")
$(this).children("p").css({ color: "White" });