JQUERY---checkbox

<title>只选择中一个checkBox.html</title>



<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="this is my page">

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<script type="text/javascript" src="jquery-1.5.js"></script>

<script type="text/javascript">

    $(function () {

        var allBoxs = $(":checkbox");

            allBoxs.click(function () {

            allBoxs.removeAttr("checked");

            $(this).attr("checked", "checked");

        });

        $(":button").click(function () {

            alert($(":checkbox:checked").val());

        });

    });

</script>

  <input type="button" value="showSlelectValue" />

<div>

    <input type="checkbox" value="1"/>

    <input type="checkbox" value="2"/>

    <input type="checkbox" value="3"/>

    <input type="checkbox" value="4"/>

</div>

你可能感兴趣的:(JQUERY---checkbox)