我认为他们可以,但我没有把我的钱放在我的嘴(这么说)设置只读属性实际上似乎没有做任何事情。

我宁愿不使用Disabled,因为我希望选中的复选框与表单的其余部分一起提交,我只是不希望客户端能够在某些情况下更改它们。


当前回答

只需使用如下所示的简单禁用标签。

<input type="checkbox" name="email"  disabled>

其他回答

这里的一些答案似乎有点迂回,但这里有一个小技巧。

<form id="aform" name="aform" method="POST">
    <input name="chkBox_1" type="checkbox" checked value="1" disabled="disabled" />
    <input id="submitBttn" type="button" value="Submit" onClick='return submitPage();'>
</form>​

然后在jquery中,你可以选择以下两个选项之一:

$(document).ready(function(){
    //first option, you don't need the disabled attribute, this will prevent
    //the user from changing the checkbox values
    $("input[name^='chkBox_1']").click(function(e){
        e.preventDefault();
    });

    //second option, keep the disabled attribute, and disable it upon submit
    $("#submitBttn").click(function(){
        $("input[name^='chkBox_1']").attr("disabled",false);
        $("#aform").submit();
    });

});

演示: http://jsfiddle.net/5WFYt/

尝试将复选框设置为只读,但不允许用户勾选。这将允许您POST复选框的值。为了这样做,您需要选择复选框的默认状态为Checked。

<input type="checkbox" readonly="readonly" onclick="this.checked =! this.checked;">

如果你想要上面的功能+不想接收复选框数据,试试下面的:

<input type="checkbox" readonly="readonly" disabled="disabled" onclick="this.checked =! this.checked;">

希望这能有所帮助。

<input name="isActive" id="isActive" type="checkbox" value="1" checked="checked" onclick="return false"/>

或者是:

$('your selector').click(function(evt){evt.preventDefault()});

如果你知道复选框总是被选中,下面的工作:

<input type="checkbox" name="Name" checked onchange='this.checked = true;'>