<!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=utf-8" />
<script type="text/javascript" src="./jquery-1.7.1.js"></script>
<title>減法寫法radio and checkbox</title>
<script>
$(document).ready(function(){
      $('.c1').change(function(){
            $('li').hide();
            $('.c1:checked').each(function(){
                $('li.' + $(this).val()).show();
            })    
      });
});

</script>
</head>




<body>
<label><input type='checkbox' class='c1' value='a' />中國</label>
<label><input type='checkbox' class='c1' value='b' />美洲</label>
<label><input type='checkbox' class='c1' value='c' />日本</label>

<div class='all_city'>
<ul>
<li class='city a'>西藏</li>
<li class='city a'>四川</li>
<li class='city b'>西雅圖</li>
<li class='city b'>波士頓</li>
<li class='city c'>京都</li>
<li class='city c'>大阪</li>
</ul>
</div>
</body>
</html>

arrow
arrow
    全站熱搜

    cabuchi 發表在 痞客邦 留言(0) 人氣()