[RadioButtonList] 자바스크립트로 선택체크하기

웹페이지

<script type="text/javascript">
    function CheckYack(clientID){
            var arrayYack =  document.getElementsByName(clientID);
            alert(arrayYack[0].checked );
    }
</script>

                    <asp:RadioButtonList ID="RadioButtonList1" runat="server"
                        RepeatDirection="Horizontal">
                        <asp:ListItem Value="1">동의</asp:ListItem>
                        <asp:ListItem Selected="True" Value="0">동의안함</asp:ListItem>
                    </asp:RadioButtonList>

  <asp:ImageButton ID="ImageButton1" runat="server"
                    ImageUrl="../image/appl/bt_next.gif" onclick="ImageButton1_Click" />

비하인드 코드

    protected void Page_Load(object sender, EventArgs e)
    { 
        ImageButton1.Attributes.Add("onClick", "return CheckYack('" + this.RadioButtonList1.UniqueID + "')");

    }

+ Recent posts