jquery:全选/全不选

<!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" />

<title>全选/全不选</title>

<script type="text/javascript" src="http://files.cnblogs.com/tinyphp/jquery-1.3.2.min.js"></script>

</head>



<body>

<input type="checkbox" name="chk_list" />

<input type="checkbox" name="chk_list" />

<input type="checkbox" name="chk_list" />

<input type="checkbox" name="chk_list" /><br />



<input type="checkbox" id="chk_all" />全选/全不选

<script type="text/javascript">

    $(function()

    {

        $("#chk_all").click(function()

        {

            $("input[name='chk_list']").attr("checked",$(this).attr("checked"));

            

        })

    })

</script>

</body>

</html>

 

你可能感兴趣的:(jquery)