日期:2014-05-16  浏览次数:20354 次

谁能给我过滤出我这个指定元素
<div class="picbox" style="display:inline">
<div class="picbox" style="display:none">
<div class="picbox" style="display:none">
我想过滤出inline该怎么写 用jquery的filter
$(".picbox").filter("")?
filter引号里该怎么写?
或者给个别的方法也可以,求解!

------最佳解决方案--------------------
$(".picbox").filter(":visible")//可见性过滤,如果还有block就需要函数来过滤了
$(".picbox").filter(function () { return this.style.display == 'inline'; })



------其他解决方案--------------------
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
function init(){
var div=document.getElementsByTagName("div");
for(var i=0;i<div.length;i++){
if(div[i].style.display=="inline"){
alert(i);
}
}
}
window.onload=init;
</script>
</head>

<body>
<div class="picbox" style="display:inline">
<div class="picbox" style="display:none">
<div class="picbox" style="display:none">
</body>
</html>
这样试试
------其他解决方案--------------------
$(".picbox").filter(function () { return this.style.display == 'inline'; }).attr("")
我想将过滤后的对象 将inline属性设置为none,那么引号里又该怎么写?
初学者不太会