asp隐藏字段回发值

时间:2015-12-17 21:28:00

标签: javascript asp.net vb.net

我有一个隐藏字段,我在回发后为其分配了一个禁用的复选框值。适用于Chrome和Firefox。但是,回发后,IE不会保留此值。建议?

ASPX.VB

Page_PreRender:

chkbxEmailPhone.Attributes.Add("onChange", "fnDisableChkBox(this);return buttonClick(this);")


If hidChkBxValue.Value = String.Empty Then
        hidChkBxValue.Value = "false"
    End If
    chkbxEmailPhone.Checked = CBool(hidChkBxValue.Value)

ASPX

<asp:CheckBox ID="chkbxEmailPhone" runat="server" Text="Include Telephone & E-Mail" AutoPostBack="true" CssClass="bold tdfont10" Value=""></asp:CheckBox>

<asp:HiddenField ID="hidChkBxValue" runat="server" Value="" />  

function fnDisableChkBox(){

    if(document.getElementById("chkbxEmailPhone").checked == true){
        document.getElementById("hidChkBxValue").value = "true";
        }
    else{
        document.getElementById("hidChkBxValue").value = "false";
        }

   document.getElementById("chkbxEmailPhone").disabled = true;
    }

</script>

0 个答案:

没有答案