写个过滤的function
var allData = [] //数组
function filter(key){
var len = allData .length
var result = []
for(var i=0i<leni++){
if(allData[i].indexOf(key)!=-1){//key 拉列表框选择相应项
result.push(allData[i])
}
}
return result
}
用jquery,去网上下载一个jquery.min.js,然后id号第一位区分品牌,第二位区分种类<script type='text/javascript' src='jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$('#f1').click(function(){
$('div').show()
$('div[name^="2"]').hide()
})
$('#f2').click(function(){
$('div').show()
$('div[name^="1"]').hide()
})
$('#s1').click(function(){
$('div').show()
$('div[name$="2"]').hide()
})
$('#s2').click(function(){
$('div').show()
$('div[name$="1"]').hide()
})
})
</script>
<div name='11'>11</div>
<div name='12'>12</div>
<div name='22'>22</div>
<div name='21'>21</div>
<button id='f1' type='button'>first is 1</button>
<button id='f2' type='button'>first is 2</button>
<button id='s1' type='button'>second is 1</button>
<button id='s2' type='button'>second is 2</button>