<%@ Page Language="VB" %> <script runat="server"> Sub Button1_OnClick(sender As Object, e As EventArgs) If Radio1.Checked = True Then Me.lblText1.Text = "Radio 1 is checked" Else If Radio2.Checked = True Then Me.lblText1.Text = "Radio 2 is checked" Else If Radio3.Checked = true Then Me.lblText1.Text = "Radio 3 is checked" End If End Sub </script> <html> <head> </head> <body> <form runat="server"> <input type="radio" id="Radio1" name="GrpRadio" runat="server"/>Option 1<br> <input type="radio" id="Radio2" name="GrpRadio" runat="server"/>Option 2<br> <input type="radio" id="Radio3" name="GrpRadio" runat="server"/>Option 3<br> <input id="Button1" type="button" OnServerClick="Button1_OnClick" value="Button" runat="server" /> <hr /> <asp:Label id="lblText1" runat="server"></asp:Label> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท