当前位置: 代码迷 >> Web前端 >> 用JQuery制造过滤
  详细解决方案

用JQuery制造过滤

热度:137   发布时间:2012-11-23 00:03:43.0
用JQuery制作过滤

jQuery提供许多过滤选择器,用来处理更复杂的选择,很多时希望知道用户所选中复选,都是通过属性来断定,那么只有得到初状态下的选中状态的选中情况。

下面写一个。。第一步用Aptana创建一个jQuery项目

<script type="text/javascript" src="lib/jquery/jquery.js">
    </script>
    <body>
        <style>
            
            .myclass {
                background-color: #ff0000;
                text-decoration: underline;
            }
            
        </style>
        <script language=javascript>
            function showstyle(box){
           
                $("input[name=" + box + "]:checked").addClass("myclass");//:checked代表所选中的多选给它添加样式
                
            }
            
            
        </script>
        <input type=checkbox name=sport>aaa<input type=checkbox name=sport>vv<input type=checkbox name=sport>bbb<input type=button name=sport onclick=showstyle('sport');>aaa
    </body>

?

  相关解决方案