日期:2014-05-18 浏览次数:20667 次
$("ul[style]").each(function() {
$(this).css("height", "500px");
});
------解决方案--------------------
<script src="JScript/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(function(){
$("ul[style]").each(function(){
$(this).css("background-color","Red");
});
});
</script>
</head>
<body>
<ul style="background-color:Blue">
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
</ul>
<ul style="background-color:Blue">
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
</ul>
</body>
</html>
------解决方案--------------------
this.attr("style","height:500px");
改
$(this).attr("","")
要加$
------解决方案--------------------
似乎不需要循环额
$("ul[style]").attr("style","要加的样式")