ASP.NET HTML 控件 Radiobutton

asp.net html 控件 radiobutton

<script  runat="server">
sub submit(sender as object, e as eventargs)
if red.checked then
   label1.text="you selected " & red.text
elseif green.checked then
   label1.text="you selected " & green.text
elseif blue.checked then
   label1.text="you selected " & blue.text
end if
end sub
</script>


<!doctype html>
<html>
<body>

<form runat="server">
select your favorite color:
<br>
<asp:radiobutton id="red" text="red" checked="true" 
groupname="colors" runat="server"/>
<br>
<asp:radiobutton id="green" text="green"
groupname="colors" runat="server"/>
<br>
<asp:radiobutton id="blue" text="blue" 
groupname="colors" runat="server"/>
<br>
<asp:button text="submit" onclick="submit" runat="server"/>
<p><asp:label id="label1" runat="server"/></p>
</form>

</body>
</html>
相关文章