Code:
<!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" xml:lang="en" lang="en">
<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
function Select(id1,id2,id3){
var items=zxcByClassName('item');
var s1=document.getElementById(id1),v1=s1.value,r1=new RegExp('\\b'+s1.value+'\\b')
var s2=document.getElementById(id2),v2=s2.value,r2=new RegExp('\\b'+s2.value+'\\b')
var s3=document.getElementById(id3),v3=s3.value,r3=new RegExp('\\b'+s3.value+'\\b')
for (var z0=0;z0<items.length;z0++){
items[z0].style.display=((r1.test(items[z0].className)||v1=='all')&&(r2.test(items[z0].className)||v2=='all')&&(r3.test(items[z0].className)||v3=='all'))?'block':'none';
}
}
function zxcByClassName(nme,el,tag){
if (typeof(el)=='string') el=document.getElementById(el);
el=el||document;
for (var tag=tag||'*',reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName(tag),ary=[],z0=0; z0<els.length;z0++){
if(reg.test(els[z0].className)) ary.push(els[z0]);
}
return ary;
}
/*]]>*/
</script></head>
<body>
<select id="S1" size="1" onchange="Select('S1','S2','S3');">
<option value="all">All Types</option>
<option value="type1">show type1</option>
<option value="type2">show type2</option>
</select>
<select id="S2" size="1" onchange="Select('S1','S2','S3');">
<option value="all">All Dates</option>
<option value="date1">show date1</option>
<option value="date2">show date2</option>
</select>
<select id="S3" size="1" onchange="Select('S1','S2','S3');">
<option value="all">All Colors</option>
<option value="color1">show color1</option>
<option value="color2">show color2</option>
</select>
<div class="item type1 date1" >
type 1
</div>
<div class="item type2 date2 color1" >
type 2
</div>
<div class="item type1 date2" >
type 1
</div>
</body>
</html>
Bookmarks